Search the Community
Showing results for tags 'gui parent & child'.
-
Hello World!!!, Please I need help for my script I am really stuck... I tried different ways but still has a problem 1st Attempt: "Test Button not working" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <GUIListViewEx.au3> $guimain = GUICreate("Form1", 960, 540, 150, 100, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_CLIPCHILDREN, $WS_TABSTOP)) Local $idFilemenu = GUICtrlCreateMenu("&File") Local $idRunmenu = GUICtrlCreateMenu("&Edit") Local $idViewmenu = GUICtrlCreateMenu("&View") Local $sInput0 = GUICtrlCreateInput("", 900, 50, 50, 20) $Child0 = GUICtrlCreateButton("Child", 900, 0, 50, 20) $List1 = GUICtrlCreateListView("", 0, 0, 500, 500, BitOR(0x0200, 0x008), BitOR(0x00000020, 0x00000001)) _GUICtrlListView_AddColumn($List1, "Col1", 150, 2) _GUICtrlListView_AddColumn($List1, "Col2", 500, 2) _GUICtrlListView_AddColumn($List1, "Col3", 50, 2) _GUICtrlListView_Scroll($List1, 10, 100) GUISetState(@SW_SHOW, $guimain) While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[0] Case $Child0 $Child1 = GUICreate("", 401, 488, 192, 124) $sLabel = GUICtrlCreateLabel("", 24, 16, 73, 17) $sInput1 = GUICtrlCreateInput("", 112, 16, 265, 21) $Test = GUICtrlCreateButton("Test", 72, 392, 75, 25) GUISetState(@SW_SHOW, $Child1) GUISetState(@SW_DISABLE, $guimain) Switch 1 Case $Test MsgBox(0, "", "Hello World!!!") EndSwitch Case $GUI_EVENT_CLOSE Switch $nMsg[1] Case $Child1 GUISetState(@SW_HIDE, $Child1) GUISetState(@SW_ENABLE, $guimain) Case $guimain Exit EndSwitch EndSwitch WEnd 2nd Attempt: "Test Button Working but Parent Window not closing" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <GUIListViewEx.au3> $guimain = GUICreate("Form1", 960, 540, 150, 100, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_CLIPCHILDREN, $WS_TABSTOP)) Local $idFilemenu = GUICtrlCreateMenu("&File") Local $idRunmenu = GUICtrlCreateMenu("&Edit") Local $idViewmenu = GUICtrlCreateMenu("&View") Local $sInput0 = GUICtrlCreateInput("", 900, 50, 50, 20) $Child0 = GUICtrlCreateButton("Child", 900, 0, 50, 20) $List1 = GUICtrlCreateListView("", 0, 0, 500, 500, BitOR(0x0200, 0x008), BitOR(0x00000020, 0x00000001)) _GUICtrlListView_AddColumn($List1, "Col1", 150, 2) _GUICtrlListView_AddColumn($List1, "Col2", 500, 2) _GUICtrlListView_AddColumn($List1, "Col3", 50, 2) _GUICtrlListView_Scroll($List1, 10, 100) GUISetState(@SW_SHOW, $guimain) While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[0] Case $Child0 Opt("GUIOnEventMode", 1) $Child1 = GUICreate("Child1", 401, 488, 192, 124) $sLabel = GUICtrlCreateLabel("", 24, 16, 73, 17) $sInput1 = GUICtrlCreateInput("", 112, 16, 265, 21) $CC = GUISetOnEvent($GUI_EVENT_CLOSE, "CloseChild") $Test = GUICtrlCreateButton("Test", 72, 392, 75, 25) GUICtrlSetOnEvent(-1, "Test") GUISetState(@SW_SHOW, $Child1) GUISetState(@SW_DISABLE, $guimain) ;~ Switch 1 ;~ Case $Test ;~ MsgBox(0, "", "Hello World!!!") ;~ EndSwitch Case $GUI_EVENT_CLOSE Switch $nMsg[1] Case $guimain Exit EndSwitch EndSwitch WEnd Func Test() MsgBox(0, "", "Hello World!!!") EndFunc ;==>Test Func CloseChild() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $Child1) GUISetState(@SW_ENABLE, $guimain) EndSelect EndFunc ;==>CloseChild