Handler callback function stops working, why?
Can someone explain to me why this doesn't work? Do hidden frames not execute "OnUpdate" script handler? I am confused. This is an extremely simple UI addon which shows an icon on target/focus if they're in combat or not in combat. I localized each function for each handler, but it seems that once the frame is hidden, it can't execute the callback anymore. Why?
Lua Code:
|
Hiding a frame stops the OnUpdate process until the frame is shown again. You could make it fully transparent.
|
Here's what I came up with as well as improving the code.
Lua Code:
This simply creates textures on the existing frame you were attaching them to instead of making dynamic frames for that purpose. Since you can hook frame scripts using :SetHook(), there really isn't a need for extra frames for script handling. This also uses the fact that TargetFrame and FocusFrame inherit SecureUnitButtonTemplate, which allow using SecureButton_GetUnit() to get their set unit instead of hard-coding them. This will allow you to reuse the code for other frames that inherit the same template. |
Nice use of SecureButton_GetUnit, I didn't even know that existed. There's probably more API I don't know about.
|
All times are GMT -6. The time now is 06:53 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI