Hi Jorge, I didn't really dive into this, but the following discussion seems to be related: http://www.mail-archive.com/fltk@easysw.com/msg02113.html Cheers, Johannes On Wed, Mar 16, 2011 at 09:44:00PM -0300, Jorge Arellano Cid wrote:
Hi there,
Please help me with this one.
Attached goes a small program that shows what may be a bug in fltk-1.3:
* resize the window back and forth and both "Group 1" and "Group 2" keep their heights. OK here. * With a small window, hide "Group 2" and resize to a big window, then show "Group 2". It grew while hidden!?
My doubts are:
Is this intended or a bug? If not a bug, how is the desired behaviour suppossed to be implemented?
I know an ugly way to workaround it (used with the findbar), but, if it's a bug, I'd prefer to have it fixed, and to keep the code clean.
What do you think?
PS: compile with: fltk-config --compile rsz.cc
-- Cheers Jorge.-
#include <stdio.h> #include <stdlib.h>
#include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Widget.H> #include <FL/Fl_Group.H> #include <FL/Fl_Button.H> #include <FL/Fl_Pack.H>
Fl_Pack *p1; Fl_Group *g1, *g2, *g3;
////////////////////////////////////////////////////////////////
static void b1_cb(Fl_Widget *w, void *data) { Fl_Group *g2 = (Fl_Group *)data;
if (g2->visible()) { g2->hide(); g3->size(g3->w(),g3->h()+g2->h()); g2->window()->redraw(); } }
static void b2_cb(Fl_Widget *w, void *data) { Fl_Group *g2 = (Fl_Group *)data;
if (!g2->visible()) { g3->size(g3->w(),g3->h()-g2->h()); g2->show(); g2->window()->redraw(); } }
int main(int argc, char **argv) { Fl_Button *b1, *b2, *b3;
Fl_Window *window = new Fl_Window(400, 400, "Fl_Pack test"); window->begin(); p1 = new Fl_Pack(0,0,400,400); p1->type(Fl_Pack::VERTICAL); p1->begin(); // a Pack with a resizable widget inside g1 = new Fl_Group(0,0,0,30, "Group 1"); g1->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); g1->box(FL_UP_BOX); g1->color(FL_CYAN); g1->end();
g2 = new Fl_Group(0,0,0,30, "Group 2"); g2->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); g2->box(FL_UP_BOX); g2->color(FL_RED); g2->end();
g3 = new Fl_Group(0,0,0,280, "Group 3 R e s i z a b l e"); g3->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); g3->box(FL_UP_BOX); g3->color(FL_GREEN); g3->end(); b1 = new Fl_Button(0,340,50,30); b1->label("Hide G2"); b1->callback(b1_cb, g2); b2 = new Fl_Button(0,370,50,30); b2->label("Show G2"); b2->callback(b2_cb, g2); p1->end(); p1->resizable(g3); window->end();
window->resizable(window); window->show(); return Fl::run();
return 0; }
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev