Jump to content

Esc key activtes the default button


Recommended Posts

hi all,

I read somewhere in the forum that pressing the Enter key will return a click on the default button (the first control to be defined) :) . But I noticed in a gui i created that the escape key also behaves the same way. :huh2:

I might have missed something but could I somehow make ESC not behave that way?

I realize that I could set ESC as a hotkey to call a function with nothing in it, but this will prevent other applications to detect ESC while the script is running. Help, please... :D

Enter key works fine (returns a click on the default button) except when the focus is on a combo box, in which case nothing happens.

Thanks for the help.

Link to comment
Share on other sites

In the newest betas, Esc is supposed to close the GUI. In previous versions, I think Esc was the same as clicking the active (focused) button.

You can un-register the Esc hotkey if another window becomes active--if you use a GuiMsg loop. Disclaimer: Coded from memory without testing:

GuiCreate("MySample")
GuiShow()
While GuiMsg(0) <> -3
   sleep(100)
   If WinActive("MySample") Then
      HotKeySet("{Esc}", "Foo");register hotkey
   Else
      HotKeySet("{Esc}");un-register
   EndIf
 ;rest of GuiMessage-handling goes here
WEnd
Exit

Func Foo()
EndFunc
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

In the newest betas, Esc is supposed to close the GUI.  In previous versions, I think Esc was the same as clicking the active (focused) button.

You can un-register the Esc hotkey if another window becomes active--if you use a GuiMsg loop.  Disclaimer:  Coded from memory without testing:

GuiCreate("MySample")
GuiShow()
While GuiMsg(0) <> -3
   sleep(100)
   If WinActive("MySample") Then
      HotKeySet("{Esc}", "Foo");register hotkey
   Else
      HotKeySet("{Esc}");un-register
   EndIf
;rest of GuiMessage-handling goes here
WEnd
Exit

Func Foo()
EndFunc
I always use this piece of script to select all text in an editbox.

You know what, I'll post a request for selecting all with CTRL+A in an editbox.

Edited by SlimShady
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...