Originally Posted by Harven
Hey, there is a mechanism for this kind of situations. It's called control pool. You take a control from the pool and when it's no longer needed you just put it back to the pool. Here is an example:
Lua Code:
--first you have to have some parent control local parentControl = WINDOW_MANAGER:CreateTopLevelWindow("MyParentControl") --[[ here you create the control pool. - the first argument is a control template which must be defined in XML file - the second argument is your parent control - the third argument is just some name you like --]] local myControlPool = ZO_ControlPool:New("MyLabelControlTemplate", parentControl, "SomeName") --then when you want to get a control from the pool you just call: local myControl, controlKey = myControlPool:AcquireObject() --controlKey is a key that allows you to put the control back to the pool --you can then do whatever you like with the control, for example attach it to your parent control: myControl:SetAnchor(CENTER, parentControl, CENTER) --when you no longer need the control, just call" myControlPool:ReleaseObject(controlKey) --the control will be hidden automatically, then you can just forget about this control myControl = nil controlKey = nil
Here an example XML to define you control template:
Code:
<GuiXml>
<Controls>
<!-- It's important to set "virtual" attribute to "true" -->
<Label name="MyLabelControlTemplate" font="ZoFontGame" virtual="true" />
</Controls>
</GuiXml>
|
dont know how i can intigrate this in my code...
And I dont use xml...
But thanks, if no one knows how I can check the exist of my texture, I will try.
I think it must be possible, to check whether the texture exist.