Jump to content

Please Confirm Escape Key Behaviour


Recommended Posts

Click the Disable button and then press the escape key on your keyboard.

Does the program exit?

If not, click on another window and then back on the GUI. Then press Escape a second time.

Does the program exit?

#include <GUIConstantsEx.au3>

_FocusExample_1()

Func _FocusExample_1()
    $hGUI = GUICreate("Focus Example", 200, 80)
    $hButton = GUICtrlCreateButton("Disable",5,5, 70,20)
    $hLabelFocus = GUICtrlCreateLabel("Press escape" & @LF & "key to quit", 10, 30, 70, 30)

    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $hButton
                GUICtrlSetState($hButton, $GUI_DISABLE)
        EndSwitch
    WEnd
EndFunc

The answers I get on XP pro SP3 are NO and YES in that order. Do you get the same result?

Edited by czardas
Link to comment
Share on other sites

Windows 7 SP1 64Bit.

Click the Disable button and then press the escape key on your keyboard.

Does the program exit? NO

If not, click on another window and then back on the GUI. Then press Escape a second time.

Does the program exit? YES

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi czardas,

unfortunately your example _FocusExample_2 doesn't work here.

Press disable and ESC: Script exits.

Press disable, set focus to another window and back to the script, press ESC: Script exits

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

water, do you mean Example 2 doesn't always quit when you hit escape? Please check I didn't accidently paste the wrong code. The forum boxes are all messed up. I had better delete my post if this is the case. I want it to exit every time you hit the escape key.

Oops, I just reread what you posted. It seems to be the way I intended. A slight misunderstanding. ;)

Press disable and ESC: Script exits.

Press disable, set focus to another window and back to the script, press ESC: Script exits

Good, thanks for the feedback.

Edited by czardas
Link to comment
Share on other sites

Oops, misunderstood the goal of your script. You always want it to exit. I thought it was the other way round.

Ignore my post ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I added an extra comment because what I wrote wasn't all that clear. Boy these code boxes are really hard work at the moment. Just one spelling mistake can take more than a minute to fix because all the indents are removed from your code every time you try and edit somehing. Arghh`

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