Jump to content

[Solved]Help with a gui called buy another gui


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...