Originally Posted by Dolgubon
I'm pretty sure controls created from Lua can handle OnUpdate. I haven't tried OnUpdate specifically but I have done OnClicked and some others, so I don't see why OnUpdate would be an exception. (control:SetHandler("OnUpdate", functionStuff) should work)
|
I stand corrected. Controls created via CreateControlFromVirtual() can have "OnUpdate" handler -- either specified in <OnUpdate> element in XML, or set later with control:SetHandler("OnUpdate", ...) -- both ways work.
However, control created via CreateControl() -- I've tested with CT_LABEL -- DOES NOT call handler set via control:SetHandler("OnUpdate", ...).
Originally Posted by Letho
They do call <OnUpdate>. Virtual controls DO NOT call <OnInitialized> though, each child control of a virtual has to call the <OnInitialized> functions seperately. That is very strange...
|
Are you sure there wasn't something else going wrong? There are lots of virtual controls with <OnInitialized> code in ZOS UI. I haven't had any problem with OnInitialized on virtual controls in add-ons, either.
For example here:
https://github.com/merlight/eso-merT...es.xml#L67-L69
Had the <OnInitialized> part not been called, I'd be getting "attempt to index a nil value" whenever I try to access control.label member.