I agree again, but it might be tricky to choose the right way...
The main point is here (AFAICT) that the "subwindow" is in FLTK's
view just another widget inside the main window. This subwindow
doesn't need to have a resizable() by itself, the only issue is to
make the subwindow react on main window resizing as desired.
The "classic" resizing mechanism can be tricky. It's pretty easy if
the subwindow occupies the full width of the main window and if it
is at the top or bottom of the window. Let's assume the subwindow is
at the top of the main window. Then it's as easy as having any other
widget (maybe an invisible Fl_Box or
an Fl_Group) below the subwindow.
That widget becomes the resizable() of
the main window. It doesn't even have to occlude the
full width of the main window. Since the resizable() widget is below
the subwindow it consumes all increases of the main window's height.
However, all widgets in the main window are resized horizontally,
and thus the subwindow resizes horizontally (width)
but not vertically (width).
window->size_range(400, 250); // not necessary, but good style to set this
window->show(argc, argv);
returnFl::run();
}
If there are other widgets below and
above the subwindow, then it becomes more complicated, and (as
others wrote) using Fl_Flex and/or Fl_Grid would likely be a better choice.
It's really worth studying these container widgets, and there are
six (6!) example programs in test/grid*.cxx and test/flex*.cxx,
resp..
Comments are owned by the poster. All other content is copyright 1998-2026 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.