WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   A Question about Simple Buttons (https://www.wowinterface.com/forums/showthread.php?t=3905)

oreth 03-01-06 10:55 PM

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?

Gello 03-01-06 11:06 PM

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.

oreth 03-02-06 12:11 PM

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.

Cryonix 03-06-06 10:58 PM

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!


All times are GMT -6. The time now is 01:25 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI