View Single Post
Unread 09-12-13, 03:25 PM   #1
Vrul
A Cobalt Mageweaver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 203
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