Is "Gui +Disabled" supposed to disable the keyboard?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
JnLlnd
Posts: 289
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Is "Gui +Disabled" supposed to disable the keyboard?

09 Feb 2014, 11:03

I'm using the "Gui +Disabled" command to prevent the user from interacting with the window while a Gui update is done after a change in a dropdown list. This update may last 2-5 seconds depending on the number of images to update. The "+disabled" option works only partly. Mouse clicks are blocked and make the Gui beep. But the keyboard is not blocked. The Up/Down keys are still active and the user can change the dropdown selection during the update. The dropdown list still has the focus.

Here is sample code:

Code: Select all

#SingleInstance force
Gui, Add, DropDownList, vList gDropDownChanged Sort, A|B|C|D|E
Gui, Add, Text, w200 vText, Choose an option in the dropdown
Gui, Show, w250 h100
return

DropDownChanged:
Gui, Submit, NoHide
Gui, +Disabled
GuiControl, , Text, Option selected: %List%. Updating the Gui...
Sleep, 2000 ; simulate the Gui doing some update
GuiControl, , Text, Gui updated
Gui, -Disabled
return
The DropDownChanged command is not triggered while the Gui is disabled. But its content can be changed and I need to avoid this. I tried to disable the dropdown list itself but, then, the list loose the focus, preventing the user to select the next item in the list immediately after the Gui would be re-enabled using the Up or Down arrows.

Is "Gui +Disabled" supposed to prevent Gui interaction with the keyboard ?

Thanks for input on this.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
alvitawa
Posts: 71
Joined: 20 Jan 2014, 09:46

Re: Is "Gui +Disabled" supposed to disable the keyboard?

09 Feb 2014, 14:51

Looks like it doesn't! But u can also disable the control:

Code: Select all

GuiControl, Disable, List
GuiControl, Enable, List

Code: Select all

#SingleInstance force
Gui, Add, DropDownList, vList gDropDownChanged Sort, A|B|C|D|E
Gui, Add, Text, w200 vText, Choose an option in the dropdown
Gui, Show, w250 h100
return

DropDownChanged:
Gui, Submit, NoHide
Gui, +Disabled
GuiControl, Disable, List 
GuiControl, , Text, Option selected: %List%. Updating the Gui...
Sleep, 2000 ; simulate the Gui doing some update.
GuiControl, Enable, List 
GuiControl, , Text, Gui updated
Gui, -Disabled
return
User avatar
JnLlnd
Posts: 289
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: Is "Gui +Disabled" supposed to disable the keyboard?

09 Feb 2014, 16:14

alvitawa wrote:Looks like it doesn't! But u can also disable the control:
Thanks alvitawa. But then, the control loose its focus and you can't continue to press Down. But another option is to assign a "do nothing" command to the arrow keys.

Code: Select all

#SingleInstance force
Gui, Add, DropDownList, vList gDropDownChanged Sort, A|B|C|D|E
Gui, Add, Text, w200 vText, Choose an option in the dropdown
Gui, Show, w250 h100
Hotkey, Up, DoNothing, Off
Hotkey, Down, DoNothing, Off
Hotkey, Left, DoNothing, Off
Hotkey, Right, DoNothing, Off
return

DropDownChanged:
Gui, Submit, NoHide
Hotkey, Up, , On
Hotkey, Down, , On
Hotkey, Left, , On
Hotkey, Right, , On
GuiControl, , Text, Option selected: %List%. Updating the Gui...
Sleep, 2000 ; simulate the Gui doing some update.
GuiControl, , Text, Gui updated
Hotkey, Up, , Off
Hotkey, Down, , Off
Hotkey, Left, , Off
Hotkey, Right, , Off
return

DoNothing:
return
Going this way, I would have to assign DoNothing many more keys (PgUp, End, etc.). There should be another way.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
just me
Posts: 6372
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Is "Gui +Disabled" supposed to disable the keyboard?

10 Feb 2014, 00:00

Code: Select all

DropDownChanged:
Gui, Submit, NoHide
Gui, +Disabled
GuiControl, Disable, List 
GuiControl, , Text, Option selected: %List%. Updating the Gui...
Sleep, 2000 ; simulate the Gui doing some update.
GuiControl, Enable, List 
GuiControl, , Text, Gui updated
Gui, -Disabled
GuiControl, Focus, List ; <<<<<<<<<<<<<<<<<<<<<<<
Return
User avatar
JnLlnd
Posts: 289
Joined: 29 Sep 2013, 21:29
GitHub: JnLlnd
Location: Montreal, Quebec, Canada
Contact:

Re: Is "Gui +Disabled" supposed to disable the keyboard?

10 Feb 2014, 07:11

just me wrote:

Code: Select all

Gui, -Disabled
GuiControl, Focus, List ; <<<<<<<<<<<<<<<<<<<<<<<
Yes. That's it. Thanks Just me.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Sabestian Caine and 156 guests