Jump to content
Sign in to follow this  
Wb-FreeKill

Close GUI made by a func?

Recommended Posts

How can i close the second GUI?

#Include <GUIConstants.au3>

GUICreate("GUI",200,200)
$Button = GUICtrlCreateButton("GUI",30,30,70,20)
GUISetstate()

Func _GUI()
$SecondGUI = GUICreate("Second GUI",200,200,100,100)
GUISetBkColor (0x3D589C)    
GUISetState(@SW_SHOW)   
EndFunc

While 1
    $msg_array = GUIGetMsg(1)
    $msg = $msg_array[0] 
    $winActive = $msg_array[1] 

    If $msg = $Button Then _GUI()

    If ($msg = $GUI_EVENT_CLOSE) AND $winActive = $SecondGUI Then 
    ;Close Second GUI?
    EndIf   
WEnd

Share this post


Link to post
Share on other sites

How can i close the second GUI?

#Include <GUIConstants.au3>

GUICreate("GUI",200,200)
$Button = GUICtrlCreateButton("GUI",30,30,70,20)
GUISetstate()

Func _GUI()
$SecondGUI = GUICreate("Second GUI",200,200,100,100)
GUISetBkColor (0x3D589C)    
GUISetState(@SW_SHOW)    
EndFunc

While 1
    $msg_array = GUIGetMsg(1)
    $msg = $msg_array[0] 
    $winActive = $msg_array[1] 

    If $msg = $Button Then _GUI()

    If ($msg = $GUI_EVENT_CLOSE) AND $winActive = $SecondGUI Then 
    ;Close Second GUI?
    EndIf    
WEnd

<{POST_SNAPBACK}>

make $SecondGUI as a global variable and just GUIDelete($SecondGUI) :)

Share this post


Link to post
Share on other sites

That simple  :)

<{POST_SNAPBACK}>

Can you tell me why you cannot find it by yourself so I can improve the documentation if needed? :D

Share this post


Link to post
Share on other sites

Can you tell me why you cannot find it by yourself so I can improve the documentation if needed? :)

<{POST_SNAPBACK}>

Was that ironic or? :D

Well i didn't know it had to be Global

Share this post


Link to post
Share on other sites

Was that ironic or?  :D

Well i didn't know it had to be Global

<{POST_SNAPBACK}>

I am always serious. If somebody don't understand how to do something with the doc I want to know why.

In your case it seems related to the AutoIt language.

The way to pass info to a function is supposed to be known assuming you learn a little bit about computer language.

We cannot insert in the doc this level of information so Forum is a right place(?) to ask question.

Too basic one always hurts an information professional as I am. But you only answers can be silly not the questions. :)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...