Jump to content

Two Simple questions from a GUI newbie...


sublimnl
 Share

Recommended Posts

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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