Thread Tools Display Modes
03-01-06, 10:55 PM   #1
oreth
A Murloc Raider
Join Date: Mar 2006
Posts: 6
A Question about Simple Buttons

I've been attempting UI Design for WoW for about a week now. I've figured out how to react to events using text and what not, but I have yet to successfully create a button.

I'm using this code inside a Frame header (in the xml file)

Code:
	<Button name="TestButton" text="Go!" hidden="false" parent="TestFrame"> 
		<Size>
			<AbsDimension x="60" y="30"/>
		</Size>
		<Anchors>
			<Anchor point="CENTER"/>
		</Anchors>
	</Button>
The script does not error out as I have outputs for when the script loads, yet I can't get my button to show up on the screen. What am I possibly doing wrong?
  Reply With Quote
03-01-06, 11:06 PM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
The button itself looks ok. It should be a transparent button with a "Go!" text. Is it in a <Frames> section?

This isn't the only way but it's a common way:

Code:
<Ui>
  <Script file="MyMod.lua"/>
  <Frame name="MyModFrame" parent="UIParent" etc>
    <Size/>
    <Anchors/>
    <Layers/> <!-- fontstrings and textures -->
    <Frames/> <!-- buttons and controls that receive mouse events -->
    <Scripts/>
  </Frame>
</Ui>
If you do:

<Frame>
<Button/>
<Frames/>
</Frame>

Then it won't see the button.
  Reply With Quote
03-02-06, 12:11 PM   #3
oreth
A Murloc Raider
Join Date: Mar 2006
Posts: 6
I had forgotten that... but it did not fix my problem

Here's my entire XML file:

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="TestingGround.lua"/>


<Frame name="TestFrame" parent="UIParent">
	<Size>
		<AbsDimension x="300" y="100"/>
	</Size>
	
	<Anchors>
		<Anchor point="TOP">
		</Anchor>
	</Anchors>
	
	<Frames>
		<Button name="$parentButton" text="Go!" parent="TestFrame"> 
			<Size>
				<AbsDimension x="60" y="30"/>
			</Size>
			<Anchors>
				<Anchor point="CENTER"/>
			</Anchors>
		</Button>
	</Frames>

<Scripts>
	<OnLoad>
		TestingGround_OnLoad();
	</OnLoad>
</Scripts>

</Frame>
</Ui>
and my LUA file

Code:
function TestingGround_OnLoad()
UIErrorsFrame:AddMessage("Loaded!" , 1,0,0,1,15);
end
and the TOC file is correct.

Now, when I reload my UI, I recieved the red "Loaded!" message in the UIErrorsFrame, but nothing else shows up anywhere.
  Reply With Quote
03-06-06, 10:58 PM   #4
Cryonix
A Defias Bandit
 
Cryonix's Avatar
Join Date: Mar 2006
Posts: 3
Oreth, take a look at this thread. It seems that you are having the same difficulty I was having. There were some links provided by shouryuu that you may find useful as well. The fara tutorial was most useful in showing the implementation of the XML code for creating a button. I hope this helps.

Good luck!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » A Question about Simple Buttons

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