Processor Posted January 22, 2013 Share Posted January 22, 2013 (edited) Hi, I'm making a simple app with a gui calling another gui (in fact a gui calling a function containing a gui) everything work except that I can't kill the second gui simply. In the exemple below I have to click on finish on the second gui then on the cross to exit the loop, whereas it should exit the loop just when we click Finish. Then when the second gui close the first too, whereas I wanted to keep it opened. expandcollapse popup#include #include Gui() Func Gui() GUICreate("Gui",600) GUISetState(@SW_SHOW) ; will display an empty dialog box $NewWindow = GUICtrlCreateButton ("NewWindow", 550, 15, 40, 370) While 1 $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $NewWindow NewGui() EndSelect WEnd EndFunc Exit Func NewGui() GUICreate("New Gui",320,240) GUISetState(@SW_SHOW) ; will display an empty dialog box $Finish = GUICtrlCreateButton ("Finish!", 270, 15, 40, 200) While 1 $msg = GUIGetMsg() Select Case $msg = $Finish ExitLoop EndSelect WEnd EndFunc Many thx for your future help. Processor. Edited January 22, 2013 by Processor Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 22, 2013 Share Posted January 22, 2013 But you are exiting the loop. The fact that you can exit the script later by closing the gui proves it. I am not sure where your confusion lies. Are you expecting ExitLoop to delete the gui? Try GUIDelete() .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Processor Posted January 22, 2013 Author Share Posted January 22, 2013 We do a good team , the solution is to use the gui delete and the exit loop Solution here: expandcollapse popup#include #include Gui() Func Gui() GUICreate("Gui",600) GUISetState(@SW_SHOW) ; will display an empty dialog box $NewWindow = GUICtrlCreateButton ("NewWindow", 550, 15, 40, 370) While 1 $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $NewWindow NewGui() EndSelect WEnd EndFunc Exit Func NewGui() GUICreate("New Gui",320,240) GUISetState(@SW_SHOW) ; will display an empty dialog box $Finish = GUICtrlCreateButton ("Finish!", 270, 15, 40, 200) While 1 $msg = GUIGetMsg() Select Case $msg = $Finish GUIDelete("New Gui") ExitLoop EndSelect WEnd EndFunc Thx for your lights!! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 22, 2013 Share Posted January 22, 2013 That is only working by accident, you should pass a windows handle to GUIDelete(), like this: $hGui = GUICreate("New Gui",320,240) --- GUIDelete($hGui) Glad you got it .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
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