Thread Tools Display Modes
05/31/21, 03:49 AM   #1
siruker
Join Date: May 2021
Posts: 4
destroying Controls

you can create control with

Code:
CreateControl("ControlName", CT_LABEL )
how would one go about destroying it.
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.
  Reply With Quote
05/31/21, 05:20 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.
  Reply With Quote
05/31/21, 06:37 AM   #3
siruker
Join Date: May 2021
Posts: 4
Originally Posted by Baertram View Post
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.
Okay I was afraid of that. If anybody knows a way for destroying them let me know. Maybe people are lazy as in normal usecases you would never create that many for it to become issue and the way to destroy them isn't known. when I was searching I came across this https://esoapi.uesp.net/100030/data/c/l/e/ClearCustomControl.html

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.

Last edited by siruker : 05/31/21 at 06:40 AM.
  Reply With Quote
05/31/21, 07:05 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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.
  Reply With Quote
06/01/21, 06:54 PM   #5
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 171
There is, in fact, a ZO_ControlPool class

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.
  Reply With Quote
06/02/21, 01:24 AM   #6
andy.s
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 40
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.
  Reply With Quote
06/03/21, 08:25 AM   #7
ShadowMau
AddOn Author - Click to view addons
Join Date: Oct 2018
Posts: 23
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.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » destroying Controls

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off