WoW:XML/Frame/frameLevel

From AddOn Studio
< XML‎ | Frame
Revision as of 04:09, 15 September 2009 by WoWWiki>Kavika (→‎Possible Values: Disambiguating after my last addition)
Jump to navigation Jump to search

What is frameLevel?

frameLevel is pretty much what it sounds like, it says what level your frame is on.

What is the difference between frameLevel and frameStrata?

Well first off, you can't set frameLevel in your <Frame> tag. frameLevel is dictated by XML nesting. Check this example out:

<Frame name="MyFrame" frameStrata="DIALOG" parent="UIParent">
  <Frames>
    <Button name="MyButton">
    </Button>
  </Frames>
</Frame>

Since UIParent's frameLevel is 1, the frame we created here should be frameLevel 2 and the Button should be frameLevel 3.

You can check a frame's level with Frame:GetFrameLevel() and you can set it with Frame:SetFrameLevel(). However, setting a frame's level is ill-advised. It is given its level automatically and it's best to leave it that way. If you need to change a frame's level in your own code, best thing to do is just nest your code differently.

Note: If the parent of a frame is changed by your code, the frame levels are not adjusted to compensate. You may need to adjust the frame's level to fix the way the frame displays.

Possible Values

  • 0 - No parent
  • 1 - Parent is UIParent
  • 2 and higher...

The maximum value seems to be 129. If you call SetFrameLevel with a value greater than 129, the value passed will be ignored, and the frame level will be set to 129.

In my experimentation, and with my WoW client (Windows), it seems higher values will stick, and be honored, if you call SetFrameLevel twice in a row. This is probably unreliable. If you find that you are having to set frame levels greater than 129, see if you can use a hierarchical set of parent frames instead.

A more complete explanation of how frame levels are used is found at How the user interface is rendered