|
08/18/14, 09:26 PM | #1 |
|
Too many Anchors
Is there some rule/limit/something on how you are allowed to set anchors? I know you can't have circular anchors, like: object A anchored to object B..and then object B anchored to object A, but I don't have that here.
I need to anchor my background to my menu bar (which is rectangular & the size of all the buttons), but it will only let me anchor to the TOPRIGHT of my menubar or it gives me the "too many anchors processed" error. Some things I've tried & other problems I had trying to do it a different way: It sounds easy enough to just set the TOPRIGHT anchor and then set the width/height, but I have a menuBar for each inventory tab and they are different sizes and for some reason GetDimensions() & GetWidth() on my MenuBar both return 0 width even after it is created & the menu buttons are added. I think it has something to do with the fact that the menuBar automatically resizes to fit descendents and even though I call GetDimensions & GetWidth AFTER the buttons are added I don't think its enough time & it hasn't finished resizing yet (but I cant turn that off because then it stays 0 width and I need to know the size of the area that the buttons take up) I haven't been able to get the correct width with them until I get into the game & use /zgoo or /znb, then it shows the correct dimensions for the menu bar. I could just put code in to resize when the window is shown, but then it would resize everytime & that seems like a waste. Thats the only way I've been able to get it to work so far. I'de much rather just figure out what the anchor problem is...or if anyone has a better idea on how to handle this. ************************************************************** If it helps any this is what everything looks like. I can post the code if you need, but its a lot. I thought the picture might be easier. The small red lines show how each button/control is anchored to another control. |
08/19/14, 04:04 AM | #2 |
|
Just thinking: <AnchorFill /> on the background woudln't work? If it's a child of the menubar, and the menubar has correct size, it should, no?
|
08/19/14, 06:31 AM | #3 | |
|
Anchor fill would make the MenuBarBackground the same size as the menu bar, which is the same size as the buttons (their total area)....and the buttons are on top, so they would completely cover the MenuBarBackground and you'd never see it. This is why I wanted to anchor in opposite corners of the menu bar (since I don't know the menu bars dimensions) I want to anchor in opposite corners and use the offset to stretch it out a little further to make it visible around the edges. This is what I WOULD LIKE TO DO: Lua Code:
|
|
08/19/14, 06:51 AM | #4 |
|
And two more:
- is bg excluded from resize? menuBarBg:SetExcludeFromResizeToFitExtents(true) - how about making bg a sibling of button container instead of child |
08/19/14, 07:09 AM | #5 | |
|
This is a menuBarBg, it is all ready a child of the MenuBar...so are the buttons, So it is all ready a sibling of the buttons, not a child of the buttons. |
|
08/19/14, 10:06 AM | #6 | ||
|
+ menuBar ++ menuBarButtonsContainer -- parent to buttons and only buttons, nothing else ++ menuBarBG -- anchor this to Container Last edited by merlight : 08/19/14 at 10:08 AM. |
||
08/19/14, 06:36 AM | #7 |
Another thought:
How did you create your background? It's possible that it inherits anchors from template, so you need to call menuBarBg:ClearAnchors() first to clear existing anchors and then set you own anchors. |
|
08/19/14, 07:03 AM | #8 | |
|
Warning: Spoiler
xml Code:
But I originally started doing this without xml. I made the background by hand: Lua Code:
I can tell you that it does allow me to set the anchors (the way I want, to more than just the TOPRIGHT) if I do EITHER ONE of the following (I don't have to do both, either one will work).
|
|
ESOUI » Developer Discussions » Lua/XML Help » Too many Anchors |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|