Killer Posted May 22, 2006 Posted May 22, 2006 I am trying to open a sub window from a window. Instead of the usual msgbox I want one where I can have my own buttons. I create a sub window but having problem closing it. Can someone help me on the code? #include <GUIConstants.au3> GUICreate("My GUI edit") $Button_2a="" $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100) $Button_2 = GUICtrlCreateButton ( "Button Test", 10, 120) $myedit=GUICtrlCreateEdit ($Button_1& @CRLF, 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL) GUISetState () ; will be append dont' forget 3rd parameter GUICtrlSetData ($myedit, "Second line",1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() if $msg = $Button_1 then GUICreate("2ndwind",150,150) $Button_1a = GUICtrlCreateButton ("Run", 10, 30, 100) $Button_2a = GUICtrlCreateButton ( "close", 10, 120) GUISetState () endif If $msg = $Button_2a and WinActive("2ndwind")=1 Then GUIDelete("2ndwind") msgbox(0,"","closeing") endif If $msg = $GUI_EVENT_CLOSE and WinActive("2ndwind")<>1 Then exitloop endif Wend
GaryFrost Posted May 22, 2006 Posted May 22, 2006 expandcollapse popup#include <GUIConstants.au3> $main_gui = GUICreate("My GUI edit") $Button_2a = "" $Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100) $Button_2 = GUICtrlCreateButton("Button Test", 10, 120) $myedit = GUICtrlCreateEdit($Button_1 & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() ; will be append dont' forget 3rd parameter GUICtrlSetData($myedit, "Second line", 1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 GUISetState(@SW_DISABLE, $main_gui) $child_gui = GUICreate("2ndwind", 150, 150) $Button_1a = GUICtrlCreateButton("Run", 10, 30, 100) $Button_2a = GUICtrlCreateButton("close", 10, 120) GUISetState() While 1 $msg2 = GUIGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE Or $msg2 = $Button_2a ExitLoop EndSelect WEnd GUISetState(@SW_ENABLE, $main_gui) GUIDelete($child_gui) Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now