destroying Controls
you can create control with
Code:
CreateControl("ControlName", CT_LABEL ) I have seen examples that merely hide the control but I want to destroy it completely. Currently I have an issue where making too many controls will start screwing with fps. So the controls are not getting removed. |
Controls are not destroyed even if you set them = nil. The garbage collector of lua will keep them until next reloadui afaik
You need to reuse controls via control pools, instead of creating new ones, if possible. Else only create controls that you really need as you need them. |
Quote:
but I have no idea how I would go around using it. EDIT: nvm took a look https://esoapi.uesp.net/100030/src/l...g.lua.html#151 it just hides it. |
I'd just create controls and reuse them instead of creating new ones. That's what ZO_ObjectPool could do e.g. Or maybe there is ZO_ControlPool as well, or similar.
|
There is, in fact, a ZO_ControlPool class :p
And no, once created, controls cannot be destroyed (they will only be destroyed on a reloadui). So you should not make infinite controls. ZO_ControlPool is a wise move if you need to continually add/remove/recycle a variable number of controls. |
I think it's also worth mentioning that reusing already created controls is much faster than deleting them (if it were possible) and creating again.
|
If you look at Simple Tooltip I use object pools to make and recycle tooltip controls. I don't claim to be an expert, but it does work and I have used GetTotalObjectCount() to make sure the pool is not running away (I left the object checks commented out in the code). If you look at the documentation in Simple Tooltip, I think I give you enough to get an easy start.
I did not know about control pools so I might look into those. |
All times are GMT -6. The time now is 10:37 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI