Thought I'd join in; does this use of Fl_Pack help?
For demo purposes, I changed the first two buttons to
change the size() of the window.
This maybe can avoid having a custom packer, lets you use
Fl_Pack to organize the buttons, and lets you resize the window
without affecting the button sizes/spacing.
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Pack.H>
void Small_CB(Fl_Widget *w, void*) { w->window()->size(500,600); }
void Large_CB(Fl_Widget *w, void*) { w->window()->size(1000,600); }
Fl_Double_Window *FirstTry(int WW, int HH) {
Fl_Double_Window* w = new Fl_Double_Window(WW, HH, "First Group Test");
const int border = 5;
Fl_Box* box = new Fl_Box(border,border,WW-2*border,HH-50-border, "A Tree
Widget" );
box->box(FL_DOWN_BOX);
box->color( fl_lighter( FL_GRAY ) );
Fl_Pack *pack = new Fl_Pack(border, box->x()+box->h()+10, box->w(), 25);
pack->type(Fl_Pack::HORIZONTAL);
pack->spacing(30);
pack->begin();
Fl_Button* b1 = new Fl_Button(1,1, 100, 30, "Small" );
b1->callback(Small_CB);
Fl_Button* b2 = new Fl_Button(1,1, 100, 30, "Large" );
b2->callback(Large_CB);
Fl_Button* b3 = new Fl_Button(1,1, 100, 30, "Go Left" );
Fl_Button* b4 = new Fl_Button(1,1, 100, 30, "Go Right" );
pack->end();
w->resizable(box);
return w;
}
int main( int argc, char** argv ) {
Fl_Window* first = FirstTry(800, 600);
first->show();
return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk