Sign in to follow this  
Followers 0
faustf

close many child gui

10 posts in this topic

hi guys    i have a gui  with   2 child like matrioska  :D parent  (push button )--> 1 child  in  child  (push button ) --->2 child

when i colse  the   last child  ,  is  all ok  the gui   killed , but   the   1 child  or parent  not  possible  close

why??

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $pass
gui()
Func gui()
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Button1 = GUICtrlCreateButton("Button1", 272, 128, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
$pass=$Form1
    GUISetOnEvent($GUI_EVENT_CLOSE, Form1Close)
EndFunc

While 1
    Sleep(100)
WEnd

Func Button1Click()
;   GUISetState( @SW_DISABLE   , $Form1)
$Form2 = GUICreate("Form1", 413, 305, 781, 414)

$Button3 = GUICtrlCreateButton("Button1", 320, 208, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click2")
GUISetState(@SW_SHOW)
$pass=$Form2
    GUISetOnEvent($GUI_EVENT_CLOSE, Form1Close)
EndFunc

 Func Button1Click2()
$Form3 = GUICreate("Form1", 413, 305, 781, 414)

$Button4 = GUICtrlCreateButton("Button1", 320, 208, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click2")
GUISetState(@SW_SHOW)

$pass=$Form3
    GUISetOnEvent($GUI_EVENT_CLOSE, Form1Close)
 EndFunc

Func Form1Close()
GUIDelete($pass)
EndFunc
Func Form1Maximize()

EndFunc
Func Form1Minimize()

EndFunc
Func Form1Restore()

EndFunc

 

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

yes  but  , i delete always  different  handel  because 

Func Form1Close()
GUIDelete($pass)
EndFunc

 

$pass is  global and i assign at them some time  handel of form1 or form2 or form3

is not correct ???

 

Edited by faustf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i bow  @mikel is perfect 

:)

 

 

Edited by faustf

Share this post


Link to post
Share on other sites
19 minutes ago, faustf said:

i bow  @mikel is perfect 

realy? GUI's are closed but Script never exit.

Share this post


Link to post
Share on other sites

@AutoBert  what your suggestion ??

Share this post


Link to post
Share on other sites

Insert a If statement for main GUI to exit

1 person likes this

Share this post


Link to post
Share on other sites

i do thankz  again :)

 

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  
Followers 0