Thread Tools Display Modes
09-12-13, 03:25 PM   #1
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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.
  Reply With Quote
09-12-13, 07:15 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
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()
__________________
WoWInterface AddOns
"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.
  Reply With Quote
09-12-13, 07:26 PM   #3
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
I think you completely missed the point of the suggestion.
  Reply With Quote
10-14-13, 01:48 PM   #4
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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.
  Reply With Quote

WoWInterface » 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