Gui Hotkeys problems

Get help with using AutoHotkey and its commands and hotkeys
j123258
Posts: 7
Joined: 08 Dec 2017, 12:12

Gui Hotkeys problems

17 Jan 2018, 02:41

I wrote a simple GUI allowing users to define their own hotkeys,it can work,but when I changed the hotkey, I got two problems.

If I set a hotkey and press setting, it can work (when I press 2 , it shows 12)

Image

and then I let hotkey and used-key be null and press setting. (I want to reset the hotkey)

Image

But the button 2 could not be used, (when I press 2 ,there is nothing) ← Problem1
and then I set the other hotkey as follow

Image

I press 1 on the WordPad , it shows 13 ( it is correct),but press 2 it also shows 13 ← Problem2

I don't know how to solve these two problems,do you have any idea?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: Gui Hotkeys problems

17 Jan 2018, 12:55

Hi j123258,


Try the following (see the comments alongside the source):

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Hope this helps.
j123258
Posts: 7
Joined: 08 Dec 2017, 12:12

Re: Gui Hotkeys problems

17 Jan 2018, 23:18

Thanks for your reply A_AhkUser

Problem 2 is be solved ,but the Problem1 doesn't.

Problem1 is when I set up a set of hotkeys,and then I want to reset the hotkey.
For example hotkey 2 ,used-Key 1 2 ,and then I reset the hotkey 2 (I let all hotkey and used-key be null and press setting in my code), so when I press 2 it will show 2 rather than null.

But I am still very grateful for your reply
A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: Gui Hotkeys problems

18 Jan 2018, 09:33

Hi j123258,
j123258 wrote:[...] I want to reset the hotkey. For example hotkey 2 ,used-Key 1 2 ,and then I reset the hotkey 2 (I let all hotkey and used-key be null and press setting in my code), so when I press 2 it will show 2 rather than null.


If I understand correctly you can add and else statement in your Setting subroutine which will actually disable the last hotkey set by the script if the first hotkey control is empty:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

j123258
Posts: 7
Joined: 08 Dec 2017, 12:12

Re: Gui Hotkeys problems

18 Jan 2018, 12:48

Thanks for your help ! A_AhkUser
A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: Gui Hotkeys problems

19 Jan 2018, 11:39

I'm glad to help! :)

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot] and 60 guests