Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Esc key activtes the default button


  • Please log in to reply
3 replies to this topic

#1 kalayaan

kalayaan

    Wayfarer

  • Active Members
  • Pip
  • 69 posts

Posted 10 June 2004 - 09:31 AM

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.







#2 CyberSlug

CyberSlug

    Overwhelmed with work....

  • MVPs
  • 3,587 posts

Posted 10 June 2004 - 12:39 PM

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, 10 June 2004 - 12:40 PM.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

#3 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 10 June 2004 - 02:10 PM

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

#4 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 10 June 2004 - 02:26 PM

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, 10 June 2004 - 02:27 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users