Sign in to follow this  
Followers 0
Scanzee

GUI

8 posts in this topic

I have written a script where a GUI creates in a function:

Func makeGUI()

GUICreate(...)

EndFunc

But how do you close the GUI in the function without Exiting the whole script?!

Is this possible and how do you do this... (I already tried with a conditionel statement but

I failed...)

Thanks Scanzee Products...<Scanzee@hotmail.com>

Share this post


Link to post
Share on other sites



I have written a script where a GUI creates in a function:

Func makeGUI()

GUICreate(...)

EndFunc

But how do you close the GUI in the function without Exiting the whole script?!

Is this possible and how do you do this... (I already tried with a conditionel statement but

I failed...)

Thanks Scanzee Products...<Scanzee@hotmail.com>

How about GUIDelete(....)


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

If you don't want to delete it and remake it... If you ever need to call it again, and only need it temporarily out of the way:

GuiSetState() Look at @SW_HIDE / @SW_DISABLE / @SW_SHOW / @SW_ENABLE

Otherwise, you'll use as Big Dod suggested with GUIDelete()


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I tried the GUIDelete in the function but nothing happened?!

But are you sure it's possible to do such thing?!

Scanzee..

Share this post


Link to post
Share on other sites

Maybe if we could see how you tried to use it....


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

case $msg = $gui_event_close

giudelete("yourGUI")


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

$handle = guicreate(..........)

do stuff

guidelete($handle)

return

Share this post


Link to post
Share on other sites

Here run this and take a look at it to get an idea:

#include <GUICONSTANTS.AU3>
MAIN_FUNC()
Func MAIN_FUNC()
    $MAIN_GUI = GUICreate("THIS IS YOUR GUI", 200, 100)
    $BUTTON_1 = GUICtrlCreateButton("DELETE", 40, 30, 50, 30)
    $BUTTON_2 = GUICtrlCreateButton("DUMMY", 100, 30, 50, 30)

    GUISetState()

    While 1
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $GUI_EVENT_CLOSE
                Exit
            Case $MSG = $BUTTON_1
                GUIDelete($MAIN_GUI)
                JUST_A_FUNC()
            Case $MSG = $BUTTON_2
                MsgBox(4096, "DUMMY MSG", "THIS BUTTON DOESN'T DO ANYTHING")
        EndSelect
        Sleep(10)
    WEnd
EndFunc
Func JUST_A_FUNC()
    Sleep(1000)
    $IMSG = MsgBox(4, "RETURN", "WOULD YOU LIKE TO RETURN TO THE GUI?")
    Select
        Case $IMSG = 6
            MAIN_FUNC()
        Case Else
            Exit
    EndSelect
EndFunc

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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