This is an interesting project and I’ve already thought about implementing something like that by my own and have already started with a small flow layout.
If your layout system would’ve been coded a bit more like standard DirectGui widgets, I could even imagine adding it as a custom feature to my DirectGui Designer - #10 by Thaumaturge.
Now to your questions.
Maybe calling resetFrameSize
before getting the bounds could help. It’s a function of the base class of every DirectGui widget.
Other than that, there are probably no other methods to get the real size except if you already have set a specific FrameSize. As a side note, there are convenient functions (which also use bounds though) to get the width, height and center of a widget which are called getWidth
, getHeight
and getCenter
.
Most DGui widgets inherit DirectFrame which most of the time is responsible for the text and background frame of the widget. The actual text then is a OnscreenText and has a separate background from the actual Frames background, which should actually be changed when the alignment changes. Now, resizing the Frame won’t update the Text as those are both separate elements. You need to tell the text that the frame has updated as otherwise the texts’ position won’t automatically be changed. I’m not entirely sure which function was responsible for resetting the text position, but you could try setText
or also resetFrameSize
.