Thread Tools Display Modes
03/14/19, 06:45 PM   #1
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Originally Posted by sirinsidiator View Post
That's not possible. Controls are here to stay once they are created. There is no way to delete them. Not even with templates.
I know, i thought ApplyTemplateToControl() might work as some sort of "ControlPoolManagementFactory", quite the way I currently handle it, but more sophisticated and elegant. Could you explain a (or probably THE) typical use case for ApplyTemplateToControl() then? I don't see a sense in it if it isnt about replacing controls.



Originally Posted by KLISK
If you decide to completely replace the object in the pool, it will not be elegant, it will be terribly expensive in terms of resources.
I am afraid there is no other way. If you have a look at my addon's menu (the right one, called "Trigger Settings"):
https://cdn-eso.mmoui.com/preview/pvw6325.png

A (De)Buff trigger has totally different configuration parameters than a combat event based trigger (the latter does not require a "Source Unit", but target and source parameters, actionResults that the aura should react to, etc.). So the "Trigger Settings" submenu totally changes if the user changes the trigger type form "(De)Buff" to "Combat Event" by using the appropriate combobox. I cannot think of a more elegant way to achieve this than just taking all relevant controls and reanchoring them to hidden pools.

Last edited by Letho : 03/14/19 at 06:49 PM.
  Reply With Quote
03/14/19, 07:46 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Letho View Post
I know, i thought ApplyTemplateToControl() might work as some sort of "ControlPoolManagementFactory", quite the way I currently handle it, but more sophisticated and elegant. Could you explain a (or probably THE) typical use case for ApplyTemplateToControl() then? I don't see a sense in it if it isnt about replacing controls.
It may be useful for lazy construction. You can create the parent (empty or only basic) control at startup, and then before it needs to be shown, choose which template to use for its contents (e.g. based on user settings, or player character class, or whatever, ...) and then apply the template. It's like two-step CreateControlFromVirtual -- in most cases you could just create the control in one step with CreateControlFromVirtual, but one limitation of such control (i.e. not created from XML) is that it cannot handle "OnUpdate" events.
  Reply With Quote
03/15/19, 12:47 AM   #3
KLISK
 
KLISK's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2018
Posts: 21
Originally Posted by Letho View Post
A (De)Buff trigger has totally different configuration parameters than a combat event based trigger (the latter does not require a "Source Unit", but target and source parameters, actionResults that the aura should react to, etc.). So the "Trigger Settings" submenu totally changes if the user changes the trigger type form "(De)Buff" to "Combat Event" by using the appropriate combobox. I cannot think of a more elegant way to achieve this than just taking all relevant controls and reanchoring them to hidden pools.
As I wrote earlier, you create an object structure through XML. You will have a template for passing to the pool. And all the parameters and handlers that will change, use SetCustomAcquireBehavior when calling an object from the pool. I don’t know if there is a better way.
@Siri, what do you say?
  Reply With Quote
03/15/19, 06:01 AM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Originally Posted by Letho View Post
Could you explain a (or probably THE) typical use case for ApplyTemplateToControl() then? I don't see a sense in it if it isnt about replacing controls.
In the vanilla UI it is often used to change the properties of shared controls based on the active ui (keyboard or gamepad).
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » ApplyTemplateToControl question


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