Reply
Thread Tools Display Modes
Unread 09-12-13, 03:25 PM   #1
Vrul
A Chromatic Dragonspawn
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 195
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.
Vrul is offline   Reply With Quote
Unread 09-12-13, 07:15 PM   #2
SDPhantom
A Molten Giant
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 992
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()
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 09-12-13 at 07:18 PM.
SDPhantom is offline   Reply With Quote
Unread 09-12-13, 07:26 PM   #3
Vrul
A Chromatic Dragonspawn
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 195
I think you completely missed the point of the suggestion.
Vrul is offline   Reply With Quote
Unread 10-14-13, 01:48 PM   #4
Vrul
A Chromatic Dragonspawn
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 195
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.
Vrul is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Wish List » Key Bind Handlers

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off