Jump to content
Sign in to follow this  
Processor

[Solved]Help with a gui called buy another gui

Recommended Posts

Processor

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

Share this post


Link to post
Share on other sites
AdmiralAlkex

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() ;)

Share this post


Link to post
Share on other sites
Processor

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

Share this post


Link to post
Share on other sites
AdmiralAlkex

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 :)

Share this post


Link to post
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
Sign in to follow this  

×