Jump to content

GUI


Scanzee
 Share

Recommended Posts

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>

Link to comment
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(....)


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

Link to comment
Share on other sites

  • Moderators

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

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.

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

Link to comment
Share on other sites

  • Moderators

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

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.

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