Understanding .layout position, size & alignment

jdxsolutions

27-09-2011 16:17:55

Trying to figure this out from examples and trial/error is kind of frustrating. Is there a tutorial or reference somewhere?

As an example, I want to have a widget with size 100x20px, but positioned to be locked 40px above the bottom of the window, and centered horizontally. [How] is that possible?

zombielei

27-09-2011 16:42:40

Hi,
Try anlignment HCenter And VTop, and with position x any and y axis 20 pixels.
MyGUI's alignment is much like wpf's concept.

jdxsolutions

27-09-2011 16:55:09

I am struggling to get it aligned at the bottom of the window. I can easily get it so it is locked the same distance above the bottom... but several hundred pixels above! If I use align bottom, the initial position of the y pos isn't behaving as I expect.

zombielei

27-09-2011 17:15:03

Oh,sorry,I just didn't read it seriously because it 24:00 in my locale.
As an example,you can test one of MyGUI samples: Demo_Console,in console.layout,you can put the combobox upper 20 pixels by setting from "5 234 305 26" to "5 234 305 26", and then resize the window, the combobox is bottom aligned with a fixed distance.Hope this will help you to understand the ui alignment theory.
BTW, English is not my native language,apologize for inappropriate phrases.

jdxsolutions

28-09-2011 08:15:21

The problem I seem to have is, when you set the align as bottom, the y position still controls the distance of the top of the widget from the top of the window... so I still have to know the initial window height, and compensate based on the widget height. I would normally expect that if I align bottom, the y value is controlling distance of the bottom of the widget from the bottom of the window.

A slightly separate question - it's not possible to combine % and px for the same widget... specify size in pixels but position in %? This seems to raise a problem for me because I want to create widgets of a certain size and align them to the right/bottom of the window, but I don't even know the initial window size in all cases.

jdxsolutions

02-10-2011 15:57:19

So am I right in my understanding - MyGUI always works relative to the parent's top-left corner? Meaning that if I want a 50px wide control to float 20px from the right edge of the window, I have to know the initial window size?
This seems quite limiting, so I hope there is a workaround but I fear not.