WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   Key Bind Handlers (https://www.wowinterface.com/forums/showthread.php?t=48127)

Vrul 09-12-13 03:25 PM

Key Bind Handlers
 
Wrapping a secure button's OnClick handler is easy enough but there always needs to be extra code to handle the key binds associated with that button. In some cases the overhead involved for processing key binds may actually be greater than the code it is there to support, especially for the primary action bar which its key binds can be redirected to two other action bars.

My suggestion would to be change the key bind handling functions to emulate being clicked rather than directly calling the function normally assigned to their OnClick handlers. So, for example, in ActionButtonDown and ActionButtonUp the line:
Code:

SecureActionButton_OnClick(button, "LeftButton")
would instead be:
Code:

button:Click("LeftButton")
Such a simple change would always allow a button with a wrapped/hooked OnClick handler to behave the same whether directly clicked or triggered via a key bind with no extra overhead.

SDPhantom 09-12-13 07:15 PM

The idea you proposed is irrelevant to keybinds and is a simplification on running a button's OnClick handler.
At any rate, your proposition already exists exactly as you described it.

See button:Click()

Vrul 09-12-13 07:26 PM

I think you completely missed the point of the suggestion.

Vrul 10-14-13 01:48 PM

If taint is a concern then this should work:
Code:

securecall(button.Click, button, "LeftButton");
or for really secure:
Code:

if (issecure()) then
    button:Click("LeftButton");
else
    SecureActionButton_OnClick(button, "LeftButton");
end

But it really is bothersome to wrap an OnClick script and still have to manually deal with keybinds.


All times are GMT -6. The time now is 12:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI