Quantcast
How to destroy control elements - ESOUI
Thread Tools Display Modes
05/12/14, 01:37 PM   #1
CrazyDutchGuy
 
CrazyDutchGuy's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 89
How to destroy control elements

I have a bunch of unnamed control windows in my TopLevelControl. Depending on the situation the controls are different, but the TopLevelControl and it's background remain the same. How can i destroy these control elements nicely ?
  Reply With Quote
05/12/14, 01:43 PM   #2
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 125
Originally Posted by CrazyDutchGuy View Post
I have a bunch of unnamed control windows in my TopLevelControl. Depending on the situation the controls are different, but the TopLevelControl and it's background remain the same. How can i destroy these control elements nicely ?
First off, how did you end up with unnamed controls? I wasn't aware that this is even possible.

Second, you can not destroy controls. Once they're created, they exist until you reloadui. You should aim to re-use controls as much as you feasibly can.
  Reply With Quote
05/12/14, 01:49 PM   #3
CrazyDutchGuy
 
CrazyDutchGuy's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 89
It is not required to name controls.

I could reuse the controls, but the code would be unnecessary complex. They kinda are all labels, but indentation may differ, they have different event handlers and so on.

it would be more easier to destroy and recreate. But if it is not possible, then i am forced to reuse
  Reply With Quote
05/12/14, 02:04 PM   #4
Roupine
Join Date: May 2014
Posts: 18
I could be wrong but there is no way to delete controls once they've been created, short of reloading the UI.
The best way to work with "temporary" controls is to use ZO_ObjectPool
  Reply With Quote
05/12/14, 02:11 PM   #5
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 125
Originally Posted by CrazyDutchGuy View Post
It is not required to name controls.
The name is the very first argument in CreateControl (second if you count the WINDOW_MANAGER self). Is there some other method for creating controls that I am not aware of?

I'm not sure what your context is, but you could do kind of what the options menu does. The options window is home to a number of option panels, access to which changes depending on which options menu you went to open. It would require a bit of engineering, but based on you description that seems like a possible solution for you.
  Reply With Quote
05/12/14, 02:46 PM   #6
CrazyDutchGuy
 
CrazyDutchGuy's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 89
You can just give a nil value for the name. I am not sure it is bad behavior to do so. But if you never going to reference the control by name, why name it then, and pollute the namespace.
  Reply With Quote
05/12/14, 04:21 PM   #7
Kith
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 49
Originally Posted by CrazyDutchGuy View Post
You can just give a nil value for the name. I am not sure it is bad behavior to do so. But if you never going to reference the control by name, why name it then, and pollute the namespace.
Unless ESO is doing something weird, its not bad behavior to leave the window with a nil name. As you say, it is one less entry in the global namespace and you can still reference those via internally saved variables. There may be some ZO_TEMPLATES that don't function properly without a name though (as some use something along the lines of GetControl(namehere) to access internal components.

Other than my options menus (using LAM), I never name any controls other than the 'base' that serves as my mods main addon table.
  Reply With Quote
05/12/14, 04:39 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 651
Yes, there are some ZO templates that require a frame name in order to function properly. This is if they use $(parent) when naming children and/or when utilizing other functions that reference the frame name, as mentioned.

However, if you are creating the controls yourself, you can just use nil in place of a global frame name/reference.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How to destroy control elements

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