Quantcast ESOUI - View Single Post - ApplyTemplateToControl question
View Single Post
03/14/19, 12:59 PM   #1
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"):

<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" />
		<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" />
		<Button name="$(parent)_CloseButton" inherits="ZO_CloseButton">
		<Button name="$(parent)SubCategorySounds" inherits="ZO_DefaultButton" text="Animations">				
			<Anchor point="TOPLEFT" relativeTo="$(parent)" anchorPoint="TOPLEFT" offsetX="0" offsetY="42" />
				WINDOW_MANAGER:ApplyTemplateToControl(self:GetParent():GetNamedChild("_DisplayContainer"), "AM_TEMP_ANIMATIONS")

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


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