Jump to content

Child Window Does Not Respond


 Share

Recommended Posts

Hi All,

I've read through some tutorials, help files, and search on this forum, but couldn't find a duplicate of my problem. I hope someone here can help. I could not get the button on the Child Window to work. the weird thing is that if I click enough times, I can see the button clicked but nothing happens. Should be easy.

Thanks in advance!! :D

#include <GuiConstants.au3>

Opt("TrayIconDebug", 1)

GuiCreate("Error Generator", 310, 240, -1, -1)

$tahoma_Bold = "Tahoma Bold"
$Label_1 = GuiCtrlCreateLabel("Error Generator", 0, 20, 300, 30, $SS_CENTER)
GUICtrlSetFont(-1, 12, 500, 0, $tahoma_Bold)
GUICtrlSetColor(-1, 0x191970)
GUICtrlCreateGroup ("", 15, 50, 280, 142)
Global $Radio_Button_1[8] = ["User Error", "Doing Nothing Error", "Abusing Error", "Tickets Error", "Bad Command Error", "Software Error", "Mouse Error", "Print Error"]
$Radio_Button_1[0] = GuiCtrlCreateRadio($Radio_Button_1[0], 25, 70, 70, 20)
$Radio_Button_1[1] = GuiCtrlCreateRadio($Radio_Button_1[1], 25, 100, 120, 20)
$Radio_Button_1[2] = GuiCtrlCreateRadio($Radio_Button_1[2], 25, 130, 85, 20)
$Radio_Button_1[3] = GuiCtrlCreateRadio($Radio_Button_1[3], 25, 160, 85, 20)
$Radio_Button_1[4] = GuiCtrlCreateRadio($Radio_Button_1[4], 170, 70, 115, 20)
$Radio_Button_1[5] = GuiCtrlCreateRadio($Radio_Button_1[5], 170, 100, 90, 20)
$Radio_Button_1[6] = GuiCtrlCreateRadio($Radio_Button_1[6], 170, 130, 75, 20)
$Radio_Button_1[7] = GuiCtrlCreateRadio($Radio_Button_1[7], 170, 160, 70, 20)
$Generate = GuiCtrlCreateButton("Generate", 115, 202, 80, 30)

GuiSetState()
While 1
 $msg = GuiGetMsg()
 Select
 Case $msg = $GUI_EVENT_CLOSE
  ExitLoop
  
 Case $msg = $Generate
  $selection = False
   For $n = 0 To 7
    If ControlCommand("Error Generator", "", $Radio_Button_1[$n], "IsChecked") Then
     execute_program ($n)
     $selection = True
    EndIf
   Next
   
   If Not $selection Then
    MsgBox(16, "Error", "Please select an error to generate.", 5)
   EndIf
  
  ;;;
 EndSelect
WEnd
Exit

Func execute_program ($isChecked)

Switch ($isChecked)
 Case 0
  MsgBox (48, "User Error", "User Error: Replace User.")
 Case 1
  GUICreate ("Doing Nothing Error", 400, 100, -1, -1)
  GUISetState (@SW_SHOW)
  $Label_2 = GUICtrlCreateLabel ("I didn't do anything to my computer and now it crashed.", 80, 20, 300, 60)
  GUICtrlSetFont(-1, 9, 500, 0, $tahoma_Bold)
  GUICtrlCreateIcon ("C:\Documents and Settings\knguyen\Desktop\Icons\shell32_180.ico", 0, 20, 30, 30, 30)
  $Help = GUICtrlCreateButton ("Get Help", 170, 65, 70, 25)
  $Cancel = GUICtrlCreateButton ("Cancel", 260, 65, 60, 25)
  Select
   Case $msg = $Cancel
    Exit
   Case $msg = $Help
    MsgBox (64, "Get Help", "Help will arrive 2 to 3 months.  Please stand by.")
  EndSelect
 Case 2
  MsgBox (0, "", "test3")
 Case 3
  MsgBox (0, "", "test4")
 Case 4
  MsgBox (0, "", "test5")
 Case 5
  MsgBox (0, "", "test6")
 Case 6
  MsgBox (0, "", "test7")
 Case 7
  MsgBox (0, "", "test8")
EndSwitch  
  
EndFunc
Link to comment
Share on other sites

Hi All,

I've read through some tutorials, help files, and search on this forum, but couldn't find a duplicate of my problem. I hope someone here can help. I could not get the button on the Child Window to work. the weird thing is that if I click enough times, I can see the button clicked but nothing happens. Should be easy.

Thanks in advance!! :D

#include <GuiConstants.au3>

Opt("TrayIconDebug", 1)

GuiCreate("Error Generator", 310, 240, -1, -1)

$tahoma_Bold = "Tahoma Bold"
$Label_1 = GuiCtrlCreateLabel("Error Generator", 0, 20, 300, 30, $SS_CENTER)
GUICtrlSetFont(-1, 12, 500, 0, $tahoma_Bold)
GUICtrlSetColor(-1, 0x191970)
GUICtrlCreateGroup ("", 15, 50, 280, 142)
Global $Radio_Button_1[8] = ["User Error", "Doing Nothing Error", "Abusing Error", "Tickets Error", "Bad Command Error", "Software Error", "Mouse Error", "Print Error"]
$Radio_Button_1[0] = GuiCtrlCreateRadio($Radio_Button_1[0], 25, 70, 70, 20)
$Radio_Button_1[1] = GuiCtrlCreateRadio($Radio_Button_1[1], 25, 100, 120, 20)
$Radio_Button_1[2] = GuiCtrlCreateRadio($Radio_Button_1[2], 25, 130, 85, 20)
$Radio_Button_1[3] = GuiCtrlCreateRadio($Radio_Button_1[3], 25, 160, 85, 20)
$Radio_Button_1[4] = GuiCtrlCreateRadio($Radio_Button_1[4], 170, 70, 115, 20)
$Radio_Button_1[5] = GuiCtrlCreateRadio($Radio_Button_1[5], 170, 100, 90, 20)
$Radio_Button_1[6] = GuiCtrlCreateRadio($Radio_Button_1[6], 170, 130, 75, 20)
$Radio_Button_1[7] = GuiCtrlCreateRadio($Radio_Button_1[7], 170, 160, 70, 20)
$Generate = GuiCtrlCreateButton("Generate", 115, 202, 80, 30)

GuiSetState()
While 1
 $msg = GuiGetMsg()
 Select
 Case $msg = $GUI_EVENT_CLOSE
  ExitLoop
  
 Case $msg = $Generate
  $selection = False
   For $n = 0 To 7
    If ControlCommand("Error Generator", "", $Radio_Button_1[$n], "IsChecked") Then
     execute_program ($n)
     $selection = True
    EndIf
   Next
   
   If Not $selection Then
    MsgBox(16, "Error", "Please select an error to generate.", 5)
   EndIf
  
  ;;;
 EndSelect
WEnd
Exit

Func execute_program ($isChecked)

Switch ($isChecked)
 Case 0
  MsgBox (48, "User Error", "User Error: Replace User.")
 Case 1
  GUICreate ("Doing Nothing Error", 400, 100, -1, -1)
  GUISetState (@SW_SHOW)
  $Label_2 = GUICtrlCreateLabel ("I didn't do anything to my computer and now it crashed.", 80, 20, 300, 60)
  GUICtrlSetFont(-1, 9, 500, 0, $tahoma_Bold)
  GUICtrlCreateIcon ("C:\Documents and Settings\knguyen\Desktop\Icons\shell32_180.ico", 0, 20, 30, 30, 30)
  $Help = GUICtrlCreateButton ("Get Help", 170, 65, 70, 25)
  $Cancel = GUICtrlCreateButton ("Cancel", 260, 65, 60, 25)
  Select
   Case $msg = $Cancel
    Exit
   Case $msg = $Help
    MsgBox (64, "Get Help", "Help will arrive 2 to 3 months.  Please stand by.")
  EndSelect
 Case 2
  MsgBox (0, "", "test3")
 Case 3
  MsgBox (0, "", "test4")
 Case 4
  MsgBox (0, "", "test5")
 Case 5
  MsgBox (0, "", "test6")
 Case 6
  MsgBox (0, "", "test7")
 Case 7
  MsgBox (0, "", "test8")
EndSwitch  
  
EndFunc
Try reducing the height of Label_2, I think it overlaps the tops of the buttons. If you click the buttons at the bottom they work for me.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

#include <GuiConstants.au3>

Opt("TrayIconDebug", 1)

$PGUI = GuiCreate("Error Generator", 310, 240, -1, -1)

$tahoma_Bold = "Tahoma Bold"
$Label_1 = GuiCtrlCreateLabel("Error Generator", 0, 20, 300, 30, $SS_CENTER)
GUICtrlSetFont(-1, 12, 500, 0, $tahoma_Bold)
GUICtrlSetColor(-1, 0x191970)
GUICtrlCreateGroup ("", 15, 50, 280, 142)
Global $Radio_Button_1[8] = ["User Error", "Doing Nothing Error", "Abusing Error", "Tickets Error", "Bad Command Error", "Software Error", "Mouse Error", "Print Error"]
$Radio_Button_1[0] = GuiCtrlCreateRadio($Radio_Button_1[0], 25, 70, 70, 20)
$Radio_Button_1[1] = GuiCtrlCreateRadio($Radio_Button_1[1], 25, 100, 120, 20)
$Radio_Button_1[2] = GuiCtrlCreateRadio($Radio_Button_1[2], 25, 130, 85, 20)
$Radio_Button_1[3] = GuiCtrlCreateRadio($Radio_Button_1[3], 25, 160, 85, 20)
$Radio_Button_1[4] = GuiCtrlCreateRadio($Radio_Button_1[4], 170, 70, 115, 20)
$Radio_Button_1[5] = GuiCtrlCreateRadio($Radio_Button_1[5], 170, 100, 90, 20)
$Radio_Button_1[6] = GuiCtrlCreateRadio($Radio_Button_1[6], 170, 130, 75, 20)
$Radio_Button_1[7] = GuiCtrlCreateRadio($Radio_Button_1[7], 170, 160, 70, 20)
$Generate = GuiCtrlCreateButton("Generate", 115, 202, 80, 30)
GuiSetState()

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Generate
            $selection = False
            For $n = 0 To 7
                If BitAnd(GUICtrlRead($Radio_Button_1[$n]), $GUI_CHECKED) Then 
                    execute_program ($n)
                    $selection = True
                EndIf
            Next
            If Not $selection Then MsgBox(16, "Error", "Please select an error to generate.", 5)
    EndSelect
WEnd


Func execute_program ($isChecked)
    Switch ($isChecked)
        Case 0
            MsgBox (48, "User Error", "User Error: Replace User.")
        Case 1
            GUICtrlSetState($Generate, $GUI_DISABLE)
            $Gui = GUICreate ("Doing Nothing Error", 400, 100, -1, -1)
            GUICtrlCreateLabel ("I didn't do anything to my computer and now it crashed.", 80, 20, 300, 40)
            GUICtrlSetFont(-1, 9, 500, 0, $tahoma_Bold)
            GUICtrlCreateIcon ("C:\Documents and Settings\knguyen\Desktop\Icons\shell32_180.ico", 0, 20, 30, 30, 30)
            $Help = GUICtrlCreateButton ("Get Help", 170, 65, 70, 25)
            $Cancel = GUICtrlCreateButton ("Cancel", 260, 65, 60, 25)
            GUISetState (@SW_SHOW, $Gui)
            While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                    Case $GUI_EVENT_CLOSE, $Cancel
                        GUIDelete($Gui)
                        GUICtrlSetState($Generate, $GUI_ENABLE)
                        ExitLoop
                    Case $Help
                        MsgBox (64, "Get Help", "Help will arrive 2 to 3 months.  Please stand by.")
                EndSwitch
            WEnd
        Case 2
            MsgBox (0, "", "test3")
        Case 3
            MsgBox (0, "", "test4")
        Case 4
            MsgBox (0, "", "test5")
        Case 5
            MsgBox (0, "", "test6")
        Case 6
            MsgBox (0, "", "test7")
        Case 7
            MsgBox (0, "", "test8")
    EndSwitch 
EndFunc

Link to comment
Share on other sites

Thanks Martin. I would have never figured it out that the label is covering up the button. :D Good eye and good catch.

Thanks to you too Smashly. I was going to work on the "Get Help" and "Cancel" button but you beat me to it and gave me a head start. Much appreciated.

Edited by dreamzboy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...