[..]
> But, to get back on topic, what is the best/preferred way to accomplish what
> I am trying to do (Dynamically hide a group)? Is it preferred to resize the
> window (shrink/expand) to fit _or_ to resize the contents to consume the
> current window's dimensions?
>
> --
> Alvin
I'm not sure if this answers the question or not, but one way
to achieve the effect that I think you're looking for is to
remove all the window's contents before resizing, then put them
back.
HTH,
Stan
#include "FL/Fl.H"
#include "FL/Fl_Double_Window.H"
#include "FL/Fl_Button.H"
#include "FL/Fl_Group.H"
class Window : public Fl_Double_Window {
public:
Window(int w, int h, char const* label = 0)
: Fl_Double_Window(w, h, label)
, btn_(w/2 - 50, h/4 - 20, 100, 40, "Click to Test")
, bottom_(0, h/2, w, h/2, "Details Here")
{
bottom_.end();
end();
btn_.callback(btn_cb, this);
bottom_.box(FL_BORDER_BOX);
bottom_.align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER);
bottom_.color(FL_GREEN);
}
private:
static void btn_cb(Fl_Widget*, void* self)
{ static_cast<Window*>(self)->btn_cb(); }
void btn_cb()
{
remove(bottom_);
remove(btn_);
if(bottom_.visible()) {
bottom_.hide();
resize(x(), y(), w(), h() - bottom_.h());
} else {
bottom_.show();
resize(x(), y(), w(), h() + bottom_.h());
}
add(bottom_);
add(btn_);
}
Fl_Button btn_;
Fl_Group bottom_;
};
int main()
{
Window win(350, 350);
win.resizable(&win);
win.show();
return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk