Quantcast
XML question - WoWInterface
Thread Tools Display Modes
04-10-05, 02:15 AM   #1
LaRIC
Premium Member
 
LaRIC's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 23
Question XML question

Is there some sort of tutorial that explains the syntax of the XML and what it does?

I have managed to write my LUA code as that was plain and simple but now I want a config window for my addon. This seems like the real pain.


I need something like

a couple of checkboxes.
An edit line
and a color setting. (something like the one from the channels color setting)

An ok and a cancel button.

Hopefully someone can point me in the right direction on where to find information or someone can make my simple page above for me.

Michael
  Reply With Quote
04-10-05, 10:20 AM   #2
Gello
A Firelord
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 491
This one you may have seen already so not sure it's much help: http://wow.mmhell.com/articles/inter...rst_addon.html

Basically goes through and describes how to make a clock window.

A lot can be learned going through the XML files on others' mods. XML seems to be totally implementation specific so unfortunately generic mods won't help at all. I'm not even sure why XML is considered a language since it's more a convention. Some things I wish I knew right off but didn't (hence the poor spaghetti xml of my mods):

- Go here: http://www.cosmosui.org/vjeux/ and grab WinMPQ and unpack the FrameXML directory in interface.mpq someplace away from your install. It's an invaluable resource to poke around and see how things are declared and used. It contains all the default .lua and .xml of the interface.

- From the same site above grab the BLP2 viewer also. When you Load MPQ on the interface.mpq, you can see all the interface textures and use them in your mod by name.

- If you plan to create many of one control, it's better to make a template for it and reuse that template. This is surprisingly easy.

For instance you can declare this:
Code:
<CheckButton name="MyButtonTemplate" virtual="true">
	<Size>
		<AbsDimension x="28" y="28"/>
	</Size>
	<Layers>
		<Layer level="BACKGROUND">
			<Texture name="$parentIcon"/>
		</Layer>
	</Layers>
	<Scripts>
		<OnEnter>
			MyButton_OnEnter();
		</OnEnter>
		<OnLeave>
			GameTooltip:Hide();
		</OnLeave>
		<OnClick>
			MyButton_OnClick();
		</OnClick>
	</Scripts>
	<NormalTexture name="$parentNormalTexture" />
	<PushedTexture file="Interface\Buttons\UI-Quickslot-Depress"/>
</CheckButton>
And instead of copy-pasting that for every button, you can use the template for each button with inherits="MyButtonTemplate":
Code:
<CheckButton name="MyFirstButton" inherits="MyButtonTemplate">
	<Anchors>
		<Anchor point="TOPLEFT"/> <- only attribute likely to change
	</Anchors>
</CheckButton>
- Only really applicable to multiple controls like above, but if you declare an "id=x" in the control's tag, you can use index = this:GetID(id) in the lua, and index will be the x you defined in the control.

Code:
<CheckButton name="MyFirstButton" inherits="MyButtonTemplate" id="1">
	<Anchors>
		<Anchor point="TOPLEFT"/>
	</Anchors>
</CheckButton>

<CheckButton name="MySecondButton" inherits="MyButtonTemplate" id="2">
	<Anchors>
		<Anchor point="BOTTOMLEFT"/>
	</Anchors>
</CheckButton>
Then in the lua to use the functions described in the template:
Code:
function MyButton_OnEnter()
    local id = this:GetID();
    GameTooltip_SetDefaultAnchor(GameTooltip,this);
    GameTooltip:SetText("This is button "..id);
    GameTooltip:Show();
end

function MyButton_OnClick()
    local id = this:GetID();
    message("You clicked button #"..id);
end
Doesn't help much starting out but definitely check the .xml files in interface.mpq and others' mods.
  Reply With Quote
04-10-05, 12:47 PM   #3
Inokis
EQInterface Staff
 
Inokis's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 156
Thanks for that Gello. I've been trying to get checkboxes to show in a window for a bit now and haven't been able to do it yet. I'll be fiddling with your examples to see if i can get them working.
__________________
If not yourself, who can you count on...

Last edited by Inokis : 04-10-05 at 04:14 PM.
  Reply With Quote
04-10-05, 03:37 PM   #4
LaRIC
Premium Member
 
LaRIC's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 23
Thanks

thanks alot for a ll the info.. Will take a look at it and figure out how to make a nice config screen.

Michael
  Reply With Quote
12-21-06, 03:23 AM   #5
Suppi
A Defias Bandit
Join Date: Dec 2006
Posts: 2
Hi,

writing my own Addon i used this for the checkbuttons in my configuration frame and i works really fine. But as the programming gets further I have to put some sliders on this frame and to to not blow up my XML file I tried to create a virtual Slider-Template which I used on my Configuration frame, but this won't work as expected. Is i possible that I can't create suche templates for Sliders?
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » XML question

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