Quantcast ApplyTemplateToControl question - ESOUI
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
03/14/19, 12:59 PM   #1
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 229
ApplyTemplateToControl question

Hey guys,

I have a TopLevelWindow that contains a header, a close button to the right and two buttons ("Sounds subcategory" and "Animations subcategory"):

Code:
<TopLevelControl name="AuraMasteryAuraActionsWindow" clampedToScreen="true" mouseEnabled="true" movable="true" tier="2" layer="2" hidden="true">
	<Dimensions x="800" y="600" />
	<Anchor point="CENTER" relativeTo="GuiRoot" relativePoint="CENTER" />
	<Controls>			
		<Backdrop name="$(parent)_Backdrop" inherits="ZO_DefaultBackdrop" />
		<Label name="$(parent)_Label" font="$(BOLD_FONT)|18|soft-shadow-thin" color="C5C29E" text="Trigger Events">
			<Anchor point="TOP" relativeTo="$(parent)" anchorPoint="TOP" offsetY="6" />
		</Label>
		<Button name="$(parent)_CloseButton" inherits="ZO_CloseButton">
			<OnClicked>self:GetParent():SetHidden(true)</OnClicked>
		</Button>
		
		<Button name="$(parent)SubCategorySounds" inherits="ZO_DefaultButton" text="Animations">				
			<Anchor point="TOPLEFT" relativeTo="$(parent)" anchorPoint="TOPLEFT" offsetX="0" offsetY="42" />
			<OnClicked>
				WINDOW_MANAGER:ApplyTemplateToControl(self:GetParent():GetNamedChild("_DisplayContainer"), "AM_TEMP_ANIMATIONS")
			</OnClicked>
		</Button>

		<Button name="$(parent)SubCategoryAnimations" inherits="ZO_DefaultButton" text="Sounds">
			<Anchor point="TOPLEFT" relativeTo="$(parent)" anchorPoint="TOPLEFT" offsetX="120" offsetY="42" />
			<OnClicked>
				WINDOW_MANAGER:ApplyTemplateToControl(self:GetParent():GetNamedChild("_DisplayContainer"), "AM_TEMP_SOUNDS")
			</OnClicked>
		</Button>				
		
		<Control name="$(parent)_DisplayContainer">
			<Anchor point="TOPLEFT" relativeTo="$(parent)" anchorPoint="TOPLEFT" offsetY="86" />
			<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" anchorPoint="BOTTOMRIGHT" />
			<Controls>
<!--
<Backdrop name="$(parent)BG" centerColor="00000000" edgeColor="00FF00">
<AnchorFill />
<Edge edgeSize="1" />
</Backdrop>
-->
			</Controls>
		</Control>
	
	</Controls>

</TopLevelControl>

I wanted to use ApplyTemplateToControl() to "attach" two different menues to "$(parent)_DisplayContainer", but the function probably works differently from what I expected.

When hiting the "AnimationsButton" for the first time everything works perfectly, the DisplayContainer is filled with the "animations template". When hiting the "SoundsButton" the DisplayContainer is filled with the "sounds template", but the "animations template" is not removed. Is ApplyTemplateToControl() not working like a templating system in php or anything comparable?


/edit: I have a suspicion: The function is used only to change data in two templates of the same structure and not to entirely replace template a) with template b), is that correct? If yes, is there another function or lib that does what I need?

Thanks in advance!

Last edited by Letho : 03/14/19 at 01:10 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » ApplyTemplateToControl question

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