Sign in to follow this  
Followers 0

Esc key activtes the default button

4 posts in this topic

Posted

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.

Share this post


Link to post
Share on other sites



Posted (edited)

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

Share this post


Link to post
Share on other sites

Posted

ESC closes the GUI in the latest beta (GuiMsg() returns -3)

Share this post


Link to post
Share on other sites

Posted (edited)

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

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.