View Single Post
05/27/14, 03:59 PM   #1
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
Question Adding multiple handlers

If a control has a handler already set, for example for "OnMouseEnter", you can add your own handler like this:

local oldHandler = control:GetHandler(event)
control:SetHandler(event, function(...) oldHandler(...) myhandler(...) end)

Unfortunately, this doesn't work when the oldHandler function uses private functions. As the function is now called from the addon environment, this leads to an exception for trying to call a private function.

Any ideas how to circumvent this problem?

I tried assigning the old handler to a global variable and use "CallSecureProtected("myglobalvariablename", ...), but this didn't work either, it's not called at all.
  Reply With Quote