Jump to content
Sign in to follow this  
sublimnl

Two Simple questions from a GUI newbie...

Recommended Posts

sublimnl

1. When I click the 'X' button to close my GUI window nothing happens. How can I get this to work normally?

2. I want to disable the Maximize/Restore button. How?

Thanks!

Share this post


Link to post
Share on other sites
Jos

1.  When I click the 'X' button to close my GUI window nothing happens.  How can I get this to work normally?

<{POST_SNAPBACK}>

Think every example in the helpfile has this in it:

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

2.  I want to disable the Maximize/Restore button.  How?

<{POST_SNAPBACK}>

WS_SYSMENU creates an window without the MAX/MIN/RESTORE button.

#include <GUIConstants.au3>

GUICreate("My GUI",-1,-1,-1,-1,$WS_SYSMENU) ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
sublimnl

Guess I should have specified that I am using OnEvent mode.

I tried "GUICtrlSetOnEvent($GUI_EVENT_CLOSE,"CGTerm")" but no joy. Is that not the proper syntax?

Share this post


Link to post
Share on other sites
Jos

Guess I should have specified that I am using OnEvent mode. 

I tried "GUICtrlSetOnEvent($GUI_EVENT_CLOSE,"CGTerm")" but no joy.  Is that not the proper syntax?

<{POST_SNAPBACK}>

GUICtrlSetOnEvent won't work on the GUI itself.... only on controls.

You need to use GUISetOnEvent.

heres and example from the helpfile:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode 
$mainwindow = GUICreate("Hello World", 200, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUICtrlSetOnEvent($okbutton, "OKButton")
GUISetState(@SW_SHOW)

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
sublimnl

Duh! Late night/early morning mistake. Thank you!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.