WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Help with XML Button (https://www.wowinterface.com/forums/showthread.php?t=546)

Saati 03-30-05 11:45 PM

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 04-06-05 04:14 PM

/bump

No one can help me with this? =(

woofiest 04-06-05 05:11 PM

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.

Saati 04-15-05 08:14 PM

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*

Gello 04-15-05 09:23 PM

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)


All times are GMT -6. The time now is 07:24 PM.

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