Jump to content

What events generate $GUI_EVENT_CLOSE


ahha
 Share

Recommended Posts

Okay, newbie here. Here's the code. Pressing the Escape key exits the GUI, why? I thought only closing the GUI would generate $GUI_EVENT_CLOSE.

;test Esc causing $GUI_EVENT_CLOSE

#AutoIt3Wrapper_run_debug_mode=Y    ; use this to debug in console window <--- LOOK

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Example    ", 500, 500)
$hList = GUICtrlCreateList("", 0, 30, 500, 500, $WS_BORDER + $WS_VSCROLL)   ;do NOT sort the list which is $WS_BORDER + $WS_VSCROLL
$sList = GUICtrlCreateList("", 0, 0, 500, 20, $WS_BORDER + $WS_VSCROLL) ;do NOT sort the list which is $WS_BORDER + $WS_VSCROLL
GUICtrlSetData($sList, "Click here ....  When done press ESC.") ;set the list
GUICtrlSetData($hList, "1|2|3|4|5|6|7|8|9|10||Problem is that pressing Escape exits this GUI.  Why, I thought only closing (x'ing out) would do that.") ;set the list
GUISetState()                   ;show the window



Do
    $msg = GUIGetMsg()

    If $msg = $sList Then
        MsgBox(0+262144, "You seleted:", GUICtrlRead($sList))
    EndIf

    If $msg = $hList Then
        MsgBox(0+262144, "You seleted:", GUICtrlRead($hList))
    EndIf

Until $msg = $GUI_EVENT_CLOSE

MsgBox(0+262144, "Status:", "$GUI_EVENT_CLOSE generated.")
Link to comment
Share on other sites

  • Moderators

Opt

GUICloseOnESC

When ESC is pressed on a GUI the $GUI_EVENT_CLOSE message is sent. This option toggles this behavior on and off.

1 = Send the $GUI_EVENT_CLOSE message when ESC is pressed (default).

0 = Don't send the $GUI_EVENT_CLOSE message when ESC is pressed.

Edited by SmOke_N

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

SmOke_N,

Thank you. I totally missed this option. I used Search in Help for "Esc" and "Escape" and didn't find it. Is there a way to dump out the entire help file so that I can brute force search for words?

Link to comment
Share on other sites

SmOke_N,

Thank you. I totally missed this option. I used Search in Help for "Esc" and "Escape" and didn't find it. Is there a way to dump out the entire help file so that I can brute force search for words?

Why would you want to do that? AutoItSetOption()/Opt() is only the fourth result, that can't be very hard to find.
Link to comment
Share on other sites

AdmiralAlkex,

You are correct - when you find it. However, this is not the first time I can't seem to find things, and a brute force search will at least let me find the items and then look them up. For another example, trying to find out if List has sort options. "list sort" in help brings up a handful of entries but even GUICtrlCreateList hides it to a newbie in the form of $LBS_SORT and does not talk about or point one to look for $WS_BORDER + $WS_VSCROLL as the key. I'm trying to avoid questions for which I can find an answer. Brute force searching for "sort" would have brought up $LBS_SORT which I see is related to GUICtrlCreateList which would have allowed me to look further on my own. That's why.

Link to comment
Share on other sites

  • Moderators

There's an online version of the help. http://www.autoitscript.com/autoit3/docs/

Edit:

I should have iterated that you could use Google search something like:

list sort site:http://www.autoitscript.com/autoit3/docs

That may help your searching in the future.

Edit2:

Well, tested the theory for myself... doesn't seem that it brought up anything specific. Thought the theory was sound though lol.

Edited by SmOke_N

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