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.