Quantcast frameStrata / toplevel / FrameLevel - WoWInterface
Thread Tools Display Modes
02-06-05, 03:43 PM   #1
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
frameStrata / toplevel / FrameLevel

Well probably all more expirienced WoW UI modders know all of these but it may be usefull for someone who is just starting
  • frameStrata
    • what it is: it't atribute which you use to define on what layer level your frame should show. Include it in your frame tag next to other atributes
    • use: frameStrata="value"
    • default value:inherits from parent if no parent is set then MEDIUM
    • Values: (From highest to lowest. ie higher frameStrata frame will be above lower one)
      • TOOLTIP (important: TOOLTIP value seem to block your frame from reciving OnMouse events like OnEnter or OnClick)
      • DIALOG
      • HIGH
      • MEDIUM
      • LOW
      • BACKGROUND (note: seting frameStrata to BACKGROUND will also block your frame from reciving mouse events until you set FrameLevel to 1 or more)
    • Notes:
      • if two frames have same frameStrata values one loaded earlier will be abowe one loaded later (that is why all orginal ui things are higher than similar level addon ones)
  • toplevel
    • what it is:same as frameStrata it is atribute, this one is kinda unknow purpose yet but it seem to affect frame graphic effects.
    • use:toplevel="true" or "false" (default)
    • Notes:
      • If 2 or more frames with same frameStrata values have toplevel set as true then normal rules will apply (ie one loaded earlier is above)
      • toplevel seem to work only on art (graphical effects) it doesnt affect things as OnEnter event (ie if lower frame is loaded earlier it still will recive OnEnter event, not the higher frame with toplevel value set on true)
  • FrameLevel(Corrections thanks to Mondinga)
    • what it is:It seem to be internal frame variable which is responsible for proper layering frames with same frameStrata value
    • use: to read FrameLevel: this:GetFrameLevel() to set FrameLevel SetFrameLevel(number)
    • Notes:
      • Frames start with FrameLevel = parent FrameLevel+1 (if parent is set) or 0 (if there is no parent)
      • FrameLevel will never bring your frame above higher frameStrata frame
      • FrameLevel affects mouse events (not like toplevel)
      • Important FrameLevel = 1 is enough to bring your frame above frame with same frameStrata and toplevel="true"

This info is based on my experiments and it may be wrong (although it shouldnt) if i made mistake somewhere please corect me

also if you have anything to add based on your personal expirience please do it

BTW: sorry for bad english and grammar -_-

Last edited by Goatus : 02-07-05 at 02:39 PM.
  Reply With Quote
02-06-05, 05:47 PM   #2
Credendo Vides
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,062
Originally Posted by Goatus
BTW: sorry for bad english and grammar -_-
No apologies necessary! Thank you very much for sharing the info with us, it should be of much value to the newer modders on the scene.
“Do what you feel in your heart to be right — for you’ll be criticized anyway.” ~ Eleanor Roosevelt
Co-Founder & Admin: MMOUI
FaceBook Profile, Page, Group
Avatar Image by RaffaeleMarinetti
  Reply With Quote
02-07-05, 12:39 PM   #3
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 66
Toplevel doesn't have anything to do with frame level. Before beta ended slouken posted saying that toplevel="true" simply means the frame is something flagged for user interaction, most likely with the mouse. What actual impacts it has I'm unsure of, as the answer was fairly vague. At any rate, this means most default UI components are set to toplevel. A few things are not though, such as the durability frame.

And a frame's level within it's strata is not always set to 0 - it is determined first by it's XML nesting. For instance, take the player health bar in the player frame. PlayerFrameHealthBar:GetFrameLevel() returns 3. If you look, it is a direct child of the PlayerFrame itself, even if PlayerFrame is not set as it's parent. So, what does PlayerFrame return for a level? PlayerFrame:GetFrameLevel() returns 2, as expected.

But why is it 2, even though it's the lowest level frame in the PlayerFrame.xml file? Because the player frame's parent is set to UIParent, and UIParent:GetFrameLevel() does indeed return 1. And if you look, UIParent's parent is set to WorldFrame, which returns 0 for a frame level.

But this doesn't entirely make sense either, or sense as you'd expect it, if you're considering how frame levels work within different strata. The UIParent is set to MEDIUM strata, the PlayerFrame is set to LOW, and the WorldFrame is set to BACKGROUND, so why would the frame level of one extend above the other, if it's set to a lower strata? Perhaps these levels are simply unimportant to the XML engine, and are something cooked up solely by the LUA engine, without a thought to strata or context at all?

As I've always thought, the :SetFrameLevel() method is a sort of hack-ish way of manually defying the XML. Indeed, if you look through a lot of the default code, Blizz will intentionally embed frames within frames within frames, seemingly without reason, simply to get to the correct frame level they need for them to display. The player frame is a great example, as is the main menu bar.

At any rate, we don't know exactly how it all works, but that doesn't impact heavily being able to use the system. In the end you usually just have to do whatever works to get things to display and operate correctly.
  Reply With Quote
02-07-05, 02:33 PM   #4
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
Well im unsure about toplevel but it does seem to affect leyering of frames (at least graphical parts as backdrops and textures...) as for flaging to mouse interaction both my frames had OnEnter events and seting toplevel on one to true actually didn't change a thing... still one that was loaded earlier was geting mouse event...

As for frame levels.. yah my mistake here, i didn't test how it acts with parent thing...

But it makes sense to me. It just do some things for you so you don't have to set it manualy everytime. Default value set as parent FrameLevel+1 (if parent exists) or 0 (if there isnt parent declared) will assure that child frame is above parent frame, and since default frameStrata for frame is same as parent frame it makes sense (So you don't need to set frameLevel and frameStrata for your frames everytime manualy).

As for that it isn't affected by frameStrata... Well i think that it doesn't metter and they knew that and didn't bother to implement more complex code.

It doesn't metter because FrameLevel comes in play mainly when you have many frames in same spot with same frameStrata and you want to sort them.
Other than that it don't affect anything since frame with higher frameStrata will show above frame with lower one even if lower one has FrameLevel set as 100 or more.

Thank you very much for corrections

i will edit first post a bit..

Last edited by Goatus : 02-07-05 at 06:08 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Tutorials & Other Helpful Info. » frameStrata / toplevel / FrameLevel

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