Any Tutorial on Using WINDOW_MANAGER?
Hey all,
I am looking for some more insight on creating controls outside of the XML. I am having a hard time understanding how each attribute is set and how to set position of each control. Any help or general walkthrough would be helpful. Thanks, Sharp |
Spend some time to study the "Controls" part of the wiki: http://wiki.esoui.com/Controls
It's not laid out in the absolute best way and is sometimes confusing, but it has (almost) all of the information you will need. A few general tips: In most cases you'll only ever need to call WINDOW_MANAGER:CreateControl(name, parent, type) or :CreateTopLevelWindow(name) Created controls/windows can be accessed directly by name after they're created, regardless of their place in the hierarchy. :SetDimensions(), :SetHidden(), :SetColor(), :SetTexture(), :SetAnchor(), :ClearAnchors(), and :SetTexture() are a few (but not all!) of the important calls for controls. (I didn't include arguments in that list in the interest of time, you can look them up on the wiki :) ) |
Quote:
|
Quote:
As for how to position using SetAnchor, that really depends on what you need. Sometimes you need to position from the CENTER, sometimes you really need BOTTOM or BOTTOMRIGHT. Do whatever fits your need at the time. It's hard to visualize at first but you'll understand it better with practice :) When in doubt, TOPRIGHT and TOPRIGHT (for self and relative) are good defaults since they are the most natural to the way the screen units are indexed. |
frame:SetAnchor(pointOnFrame, relativeToThisFrame, pointOnThatOtherFrame, offsetX, offsetY)
Offsets increase in a positive direction to the right (for X) and down (for Y). They increase in a negative direction to the left (for X) and up (for Y). So... If you want to anchor your MyAddonFrame to the main screen (GuiRoot), in the top-left corner, but out from each side about 10 pixels, you'd do this: Lua Code:
If you want to anchor the left side of your MyAddonFrame2 to the right side of your MyAddonFrame1, you'd do this: Lua Code:
If you want to make your MyAddonBG texture fill your whole MyAddonFrame (anchoring to all corners), then you can do this: Lua Code:
One last example: if you want your MyAddonFrame to spread across the bottom of the screen, without having to worry about figuring out how big the users screen is (resolution/width), then you can do this: Lua Code:
|
Thanks both of you for your input, it has really helped me a lot! I may ask more if I get stuck again.
|
Code:
WINDOW_MANAGER:CreateControl(name, parent, type) |
It's used all the time. It's to say what type of control you are creating.
http://wiki.esoui.com/Globals#ControlType |
Quote:
|
Any tips on getting it Centered in the parent control? will I need to use the offset x/y or is there an easier way?
|
Try that
lua Code:
|
In the above case, where there is no x or y offset, and your anchoring in relation to the parent, you may do simply this:
Lua Code:
|
All times are GMT -6. The time now is 08:06 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI