On 11/30/21 7:05 AM, Albrecht Schlosser wrote:
On 11/30/21 2:46 PM 'Mark' via fltk.general wrote:
I want to have a row of buttons like this:
[New] [Options] ...gap... [About] [Help] ...gap... [Quit]
With standard FLTK (1.4, git, as of today) I'd derive my own container widget from Fl_Group and override the resize() method.
However, I'm working on a new Fl_Grid widget that can do easily what you want to achieve. This is intended to be in FLTK 1.4.0 when released, hopefully early in the next year (Jan, Feb, Mar?).
I want to have a row of buttons like this:[New] [Options] ...gap... [About] [Help] ...gap... [Quit]Where the first two are aligned to the left of the parent window, the middle two are in the middle of the row and the last one is on the right. And of course I want them to keep these relative positions when the window is resized.
And here's the aforementioned illustration: Compiled and tested with "fltk-config --compile layout.cxx", worked OK.
*Why* it works is left as an exercise for the reader, as it's too hard to explain...
Thank you for all your suggestions.I reread the FLTK docs on layouts and tried to use its advice, but was still defeated.I did succeed in the end though, no thanks to the docs! I used a flex layout. I set each button to a fixed size and put a tiny frame in each of the two gaps. The flex layout automatically gave all spare space to these frames (and seems to do so equally), so I got the exact layout I wanted.