Jump to content

Recommended Posts

Posted (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.

#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 by Processor
Posted

We do a good team ;) , the solution is to use the gui delete and the exit loop ;)

Solution here:

#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!!

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
×
×
  • Create New...