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
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 -_-
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.
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..
|All times are GMT -6. The time now is 08:48 AM.|
vBulletin © 2017, Jelsoft Enterprises Ltd
© 2004 - 2017 MMOUI