Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-08-17, 09:05 AM   #1
napnap
A Kobold Labourer
Join Date: Mar 2017
Posts: 1
Adding a button to a template UI

Hi!

So I want to add a button to a template, the template I'm talking about is this one:

This red area is this one :
Code:
	<Button name="LFGListApplicantMemberTemplate" virtual="true">
		<Size x="190" y="20"/>
		<Layers>
			<Layer level="ARTWORK">
				<FontString parentKey="Name" inherits="GameFontNormalSmall" justifyH="LEFT" text="NAME">
					<Size x="100" y="10"/>
					<Anchors>
						<Anchor point="LEFT" x="7" y="-1"/>
					</Anchors>
				</FontString>
				<FontString parentKey="ItemLevel" inherits="GameFontNormalSmall" justifyH="CENTER" text="529">
					<Anchors>
						<Anchor point="CENTER" relativeKey="$parent" relativePoint="LEFT" x="177" y="-1"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Frames>
			<Frame parentKey="FriendIcon">
				<Size x="20" y="19"/>
				<Anchors>
					<Anchor point="LEFT" relativeKey="$parent.Name" relativePoint="RIGHT" x="0" y="0"/>
				</Anchors>
				<Layers>
					<Layer level="ARTWORK">
						<Texture parentKey="Icon" atlas="groupfinder-icon-friend" setAllPoints="true"/>
					</Layer>
				</Layers>
				<Scripts>
					<OnEnter>
						if ( self.relationship == "friend" ) then
							GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
							GameTooltip:SetText(LFG_LIST_FRIEND, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1, true);
							GameTooltip:Show();
						elseif ( self.relationship == "guild" ) then
							GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
							GameTooltip:SetText(LFG_LIST_GUILD_MEMBER, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1, true);
							GameTooltip:Show();
						else
							GameTooltip:Hide();
						end
					</OnEnter>
					<OnLeave function="GameTooltip_Hide"/>
				</Scripts>
			</Frame>
			<Button parentKey="RoleIcon1">
				<Size x="18" y="18"/>
				<Anchors>
					<Anchor point="LEFT" x="104" y="0"/>
				</Anchors>
				<NormalTexture/>
				<HighlightTexture alphaMode="ADD"/>
				<Scripts>
					<OnClick>
						PlaySound("igMainMenuOptionCheckBoxOn");
						C_LFGList.SetApplicantMemberRole(self:GetParent():GetParent().applicantID, self:GetParent().memberIdx, self.role);
					</OnClick>
				</Scripts>
			</Button>
			<Button parentKey="RoleIcon2">
				<Size x="18" y="18"/>
				<Anchors>
					<Anchor point="LEFT" relativeKey="$parent.RoleIcon1" relativePoint="RIGHT" x="1" y="0"/>
				</Anchors>
				<NormalTexture/>
				<HighlightTexture alphaMode="ADD"/>
				<Scripts>
					<OnClick>
						PlaySound("igMainMenuOptionCheckBoxOn");
						C_LFGList.SetApplicantMemberRole(self:GetParent():GetParent().applicantID, self:GetParent().memberIdx, self.role);
					</OnClick>
				</Scripts>
			</Button>
			<Button parentKey="RoleIcon3">
				<Size x="18" y="18"/>
				<Anchors>
					<Anchor point="LEFT" relativeKey="$parent.RoleIcon2" relativePoint="RIGHT" x="1" y="0"/>
				</Anchors>
				<NormalTexture/>
				<HighlightTexture alphaMode="ADD"/>
				<Scripts>
					<OnClick>
						PlaySound("igMainMenuOptionCheckBoxOn");
						C_LFGList.SetApplicantMemberRole(self:GetParent():GetParent().applicantID, self:GetParent().memberIdx, self.role);
					</OnClick>
				</Scripts>
			</Button>
		</Frames>
		<Scripts>
			<OnLoad>
				self:RegisterForClicks("RightButtonUp");
			</OnLoad>
			<OnClick>
				PlaySound("igMainMenuOptionCheckBoxOn");
				EasyMenu(LFGListUtil_GetApplicantMemberMenu(self:GetParent().applicantID, self.memberIdx), LFGListFrameDropDown, self, 60, -5, "MENU");
			</OnClick>
			<OnEnter function="LFGListApplicantMember_OnEnter"/>
			<OnLeave function="GameTooltip_Hide"/>
		</Scripts>
	</Button>
So my code looks like this:
Code:
<Ui>
    <Frame name="MyAddon" parent="LFGListApplicantMemberTemplate">
        <Size x="18" y="18"/>
        <Anchors>
            <Anchor point="TOPLEFT" relativePoint="TOPLEFT" x="4" y="-2"/>
        </Anchors>
        <Frames>
            <Button parentKey="MyAddonButton" inherits="UIMenuButtonStretchTemplate">
                <Size x="18" y="18"/>
                <Anchors>
                    <Anchor point="LEFT" relativeKey="$parent.Name" relativePoint="RIGHT" x="0" y="0"/>
                </Anchors>
                <HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
            </Button>
        </Frames>
        <Scripts>
            <OnLoad>
                    self.MyAddonButton:SetText("Addon")
            </OnLoad>
        </Scripts>
    </Frame>
</Ui>
But nothing shows up. Any help please?
  Reply With Quote
 

WoWInterface » Developer Discussions » Graphics Help » Adding a button to a template UI


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