Quantcast
XML StatusBar help - WoWInterface
 
Thread Tools Display Modes
02-27-15, 05:39 PM   #1
Mugi
A Murloc Raider
Join Date: Feb 2015
Posts: 6
XML StatusBar help

Hiya, I can't seem to get a StatusBar to be created and displayed. Here is the current version of my status bar:

Code:
<StatusBar name="$parent_status" minValue="0" maxValue="100" defaultValue="30" orientation="HORIZONTAL">
	<Scripts>
		<OnLoad>print("start")</OnLoad>
	</Scripts>
	<Size x="150" y="30"/>
	<Anchors>
		<Anchor point="CENTER" relativePoint="CENTER" relativeTo=""/>
	</Anchors>
	<BarColor r="1.0" g="0" b="0"/>
</StatusBar>
Previously I have tried inheriting various StatusBar templates, explicitly setting a bar texture, and a few other different variations of this type of template, but the onload script never runs, and I can see the bar is not added to my frame when using the framestack.

Anyone know what I'm missing?
  Reply With Quote
02-27-15, 07:02 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
A parent object?
  Reply With Quote
02-27-15, 10:29 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You either need a parent (highly recommended) or a valid attribute for your anchor's "relativeTo" attribute.

If your frame is logically attached to another frame (eg. you're adding another statusbar to the player frame) use that frame as its parent. If your frame is standalone, parent it to the UIParent. Without a parent (or some chain of parentage that leads to the UIParent) your frame will not respect UI scaling changes and won't be hidden when the user presses Alt-Z to hide the UI (eg. when taking a screenshot).

Also, the "$parent" token in a frame name should never be used if your frame doesn't have a parent, and should generally not be used if your frame's parent is part of the default UI or some other addon, since it may override something else that already exists, or result in other unexpected behavior. Make sure your frame's name is unique (so it won't conflict with other frames) and clearly identifies your addon (so users can figure out what addon that statusbar they want to move belongs to by using the "/framestack" command or other tools).
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Donít message me about addon bugs or programming questions.

Last edited by Phanx : 02-27-15 at 10:31 PM.
  Reply With Quote
02-28-15, 05:42 AM   #4
Mugi
A Murloc Raider
Join Date: Feb 2015
Posts: 6
Hi sorry for the confusion, I just posted the relevant part of the XML - the fragment I posted is inside a grey parent frame which is loading and displaying just fine. When I get back to my PC I will try removing the relativeTo property from the anchor tag and see if it loads properly.
  Reply With Quote
02-28-15, 01:30 PM   #5
Mugi
A Murloc Raider
Join Date: Feb 2015
Posts: 6
OK removing the relativeTo property did not cause the scrollbar to load. Anything else i'm missing here?
  Reply With Quote
02-28-15, 11:34 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Post your entire code. Posting random snippets is worse than useless, especially when you don't even mention that what you posted isn't your entire code.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Donít message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » XML StatusBar help

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