Sign in to follow this  
Followers 0
Mechaflash

Disable/Enable hotkeys at will

6 posts in this topic

Trying to figure out a way to disable and renable hotkeys at my beckoning.

I've set hotkeys for my GUI buttons to scroll through some images ({pgup} and {pgdn}). Once in a while, the image viewer will lag so the user hits the key multiple times (as most do when something doesn't work they press the button again and again thinking that it helps ;) ) so it queues up the function that the hotkey was bound to and now they have an auto-scrolling gallery for X amount of times they pressed the hotkey. So I want to disable them for a period of time and then re-enable them.

Has anyone done this before?


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites



Disable it at the start of the function, and re-enable it at the end. It is fairly common practice for longer functions.

Are you actually using hotkeys or are you using accelerators?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is how avoid spamming the hotkeys.

func hotkeyfunction900()
hotkeyset($hk[900][9]);disable the hotkey
dofunction(900);do the function based on the specification of $hk[900][]
hotkeyset($hk[900][9], "hotkeyfunction900");reassign the hotkey after the function is complete
Endfunc
Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

@Mat using HotKeySet() as I want them accessible even if the app doesn't have focus.

And GAH! just delete this thread =/ stupid me I just noticed the helpfile states "Not specifying this parameter will unset a previous hotkey." for the second paramter of HotKeySet [, "function"]

I will now take my life in the most disgusting manner possible.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I totally just showed you that in my code example. Sheesh. I learnt it from the help file too!

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

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