Quantcast WoWInterface - View Single Post - SecureHandlerAttributeTemplate optimization
View Single Post
03-23-19, 06:21 AM   #6
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
Originally Posted by Terenna View Post
One thing I can't resolve, is why I need to RegisterStateDriver for visibility for the :SetAttribute('_onattributechanged', _onAttributeChanged) to actually fire. Without this RegisterStateDriver(...) line, this doesn't happen. Is there anyone who can explain that finding?
In the WoW Lua enviroment events are global and scripts are like a mini-event unique to an individual object. So when you do something like:
Code:
buttons[i]:SetAttribute('statehidden', true)
Each button[i]'s OnAttributeChanged script is called if their 'statehidden' attribute wasn't already true. You didn't hook each button[i]'s OnAttributeChanged script but rather made a secure frame with it's own OnAttributeChanged script. In that case you have to register a state driver for that new secure frame that changes states at the times you want to evaluate those buttons.

Hopefully I explained that in a way that answered your question.
  Reply With Quote