Jump to content

Gui close and minimize buttons


kaotkbliss
 Share

Recommended Posts

I've only just started messing with GUIs and I was curious, The minimize button works by default with no additional code, but for the "X" button you need to code a GUI_Event_Close line to exit the script. Why is that?

there is already the GUIEvent commands to change the function of these.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I've only just started messing with GUIs and I was curious, The minimize button works by default with no additional code, but for the "X" button you need to code a GUI_Event_Close line to exit the script. Why is that?

there is already the GUIEvent commands to change the function of these.

I believe this is because Windows acts upon a window on its own, such as closing or minimizing, as well as sending the message. Basically, what you're doing with the Case $GUI_EVENT_CLOSE Exit is telling the script to terminate when the window is closed. If you didn't, windows would close the window (due to default Windows behavior), but the process would continue to run. Ending the process is only an optional command, but it is usually included in many examples and complete scripts for proper operation of the program. The reason additional code is used, is that no action is really taken by the script when a window is minimized. It's just minimized, and the script continues normally. On the contrary, when the user presses close, he or she expects the program to terminate, so additional code is required for that.

Please take a look at the Opt function, specifically "GUIEventOptions". It allows you to suppress Windows' actions when close or minimize is clicked, an just send the message. This is useful if you would like a window to "minimize to the tray" on minimize and/or close.

I hope this helps you,

Zach

Link to comment
Share on other sites

Makes sense

Thanks for the answer.

My first gui I didn't code anything for the "X" because I assumed it would close and exit the script automatically.

Now, I make sure I add the exit command for that button ;)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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