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. |
You could try using ZO_PreHookHandler() that I THINK exists because I THINK I remember hearing someone talking about it in IRC or some other thread...
But I believe that would be a 100% safe way to do what you're wanting UNLESS you absolutely need a post-hook instead... In a case like that, I'd still prehook and then in the called function, do a zo_callLater(myFunction(myArgs), 25) to make the function fire almost instantly after the handle function. Very hacky, but it works. |
haha, yeah... that's just aching for a race condition on a crappy computer. :)
|
Quote:
|
Quote:
ZO_PreHookHandler() works like a charm for my case, no problem with internals overriding my settings afterwards. |
All times are GMT -6. The time now is 08:30 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI