Reply
Thread Tools Display Modes
Unread 03-30-05, 11:45 PM   #1
Saati
A Murloc Raider
Join Date: Mar 2005
Posts: 4
Help with XML Button

I created a script, it works fine, but after my <Layers></Layers> tags, I tried to put in the following code:

Code:
<Frames>
	<Button name="MyScriptOptionsButton" hidden="false">
		<Size>
			<AbsDimension x="19" y="19" />
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT" relativePoint="BOTTOMRIGHT">
				<Offset>
					<AbsDimension x="1" y="1" />
				</Offset>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				this.tooltip = "Configure My Script";
			</OnLoad>
			<OnEnter>
				GameTooltip:SetOwner(this, "ANCHOR_LEFT");
				GameTooltip:SetText(this.tooltip);
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Button>
</Frames>
And it crashes WoW. I have tried to figure out what's wrong with my code and I can't figure it out. If I take this bit of code out it works.

Any help would be much appreciated.
Thanks in advance,
-Saati
Saati is offline   Reply With Quote
Unread 04-06-05, 04:14 PM   #2
Saati
A Murloc Raider
Join Date: Mar 2005
Posts: 4
/bump

No one can help me with this? =(
Saati is offline   Reply With Quote
Unread 04-06-05, 05:11 PM   #3
woofiest
A Flamescale Wyrmkin
 
woofiest's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 95
just wonder.. I'm at work and I'm no guru... I'm just a total noobs,

but are you doing:

<frames>... <layers>...<layer></layer>...</layers></frames> and then follow with your chunk of <frames>...<button></button></frames> section?


if you are only going to have a single <button> inside, why are you using <frames> instead of <frame> (without the "s")?

The mod that I wrote and released have <frame>...<button></button>...<frame> in it, as well as something like <frames> ... <button></button><button></button><button></button>...</frames> in it, and it works just fine.

hope I'm making some sense to you.
__________________
Give me MY Warden Staff...

==== For Mod Hogger ======================================
http://www.wowinterface.com/
http://www.wowguru.com/ui
http://www.curse-gaming.com/
http://ui.worldofwar.net/
woofiest is offline   Reply With Quote
Unread 04-15-05, 08:14 PM   #4
Saati
A Murloc Raider
Join Date: Mar 2005
Posts: 4
Sorry for my late reply. Things have been kinda hectic at work so I haven't had a chance to try your suggestion until now...

I tried <frame> instead of <frames> and it doesn't crash, but I still don't see the button, but perhaps that's because of the rest of the code.

I'm still trying to figure out how to put the button where I want it and use the texture that I want. *shrugs*
Saati is offline   Reply With Quote
Unread 04-15-05, 09:23 PM   #5
Gello
A Scalebane Royal Guard
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 435
I'm no expert but I believe you want:

Code:
<Frame name="MyScriptOptionsFrame">
    <Frames>
	<Button name="MyScriptOptionsButton" hidden="false">
		<Size>
			<AbsDimension x="19" y="19" />
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT" relativePoint="BOTTOMRIGHT">
				<Offset>
					<AbsDimension x="1" y="1" />
				</Offset>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				this.tooltip = "Configure My Script";
			</OnLoad>
			<OnEnter>
				GameTooltip:SetOwner(this, "ANCHOR_LEFT");
				GameTooltip:SetText(this.tooltip);
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Button>
    </Frames>
</Frame>
The button will also be invisible until you give it textures:

Code:
<Frame name="MyScriptOptionsFrame">
    <Frames>
	<Button name="MyScriptOptionsButton" hidden="false">
		<Size>
			<AbsDimension x="19" y="19" />
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT" relativePoint="BOTTOMRIGHT">
				<Offset>
					<AbsDimension x="1" y="1" />
				</Offset>
			</Anchor>
		</Anchors>
		<NormalTexture file="Interface\Buttons\UI-CheckBox-Up"/>
		<PushedTexture file="Interface\Buttons\UI-CheckBox-Down"/>
		<HighlightTexture file="Interface\Buttons\UI-CheckBox-Highlight" alphaMode="ADD"/>
		<Scripts>
			<OnLoad>
				this.tooltip = "Configure My Script";
			</OnLoad>
			<OnEnter>
				GameTooltip:SetOwner(this, "ANCHOR_LEFT");
				GameTooltip:SetText(this.tooltip);
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Button>
    </Frames>
</Frame>
I use the CheckBox textures only as an example. You would want to use a Checkbutton instead of Button to make a checkbutton control. Lots of stuff built in. If you want just a red standard button:

<NormalTexture file="Interface\Buttons\UI-DialogBox-Button-Up"/>
<PushedTexture file="Interface\Buttons\UI-DialogBox-Button-Down"/>
<HighlightTexture file="Interface\Buttons\UI-DialogBox-Button-Highlight" alphaMode="ADD"/>

If you want to make a button with text on it, you can inherit the GameMenuButtonTemplate (there are others, but I'm new to this too lol)

Code:
<Frame name="MyScriptOptionsFrame">
    <Frames>
	<Button name="MyScriptOptionsButton" inherits="GameMenuButtonTemplate" text="Options">
		<Size>
			<AbsDimension x="70" y="19" />
		</Size>
		<Anchors>
			<Anchor point="TOPLEFT" relativePoint="BOTTOMRIGHT">
				<Offset>
					<AbsDimension x="1" y="1" />
				</Offset>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				this.tooltip = "Configure My Script";
			</OnLoad>
			<OnEnter>
				GameTooltip:SetOwner(this, "ANCHOR_LEFT");
				GameTooltip:SetText(this.tooltip);
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</Button>
    </Frames>
</Frame>
(changed x size to 70 so the word is readable)
Gello is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » Help with XML Button

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