DirectGui layout system

Oh wow–I actually started in on something very like this, but abandoned it. It looks like you took it much further than I ever did! Very well done! :smiley:

As to your questions:

Hmm… I’m not sure. Aside from what others have already said, I have an arcane method of my own design that does this job. (I forget what prompted me to make it.) I could share it, if you like. :slight_smile:

However, could you give me a short bit of example-code showing this issue with “getBounds”? A quick experiment with a DirectButton had it reporting bounds immediately after the button was constructed, and while I don’t know whether those bounds are correct, they seem reasonable.

I think that there’s a caveat here: changing the frame-size doesn’t actually affect where the button thinks its “left”, “right”, and “centre” are. Instead, it’s the other way around: the frame-size seems to be specified relative to the text-anchor.

You can see this in action if you construct buttons with left- or centre- anchors, then change their frame-sizes such that they have a left-extent of zero. (Which should thus tell you where the buttons think that zero is.) You should find that in buttons with a left text-alignment, the left-hand extent of the button ends up at the left of the text, and that in buttons with a centre-alignment, the left-hand extent ends up at the centre of the text.

It’s arguably not intuitive, but it does seem to be the way that it works. ^^;

If I’m not much mistaken, “resetFrameSize” is used when doing the opposite: asking DirectGUI to calculate a new frame-size for some change, like new button-text.