Sign in to follow this  
Followers 0
czardas

Please Confirm Escape Key Behaviour

11 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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`

Share this post


Link to post
Share on other sites

because all the indents are removed

Switch to text mode (button above B (Bold)). In this mode, the indents are not removed.

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