DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2304
Version: 1.3-current


I looked into this and reduced the problem to a much smaller demo program.
First I couldn't reproduce the bug, but then I added a big Fl_Group widget
to the Fl_Scroll, and then the bug showed up as in the OP's test program.
Please see instructions in the attached file scroll_1.cxx.

Currently my suspicion is that it either has to do with fl_scroll() or
with clipping, but that needs to be investigated. Both use system specific
functions...


Link: http://www.fltk.org/str.php?L2304
Version: 1.3-current
/*
  This demo program shows the drawing bug (STR #2304) on Linux, but works
  well on Windows (Mac currently untested).

  Compile and run with:

  fltk-config --compile scroll_1.cxx && ./scroll_1

  The bug can only be seen if the Fl_Scroll widget has a Fl_Group child,
  and this Fl_Group becomes more than 32767 pixels high by adding more than
  about 1310 child widgets and resizing the Fl_Group accordingly.

  It works okay, if the Fl_Group is omitted and the Fl_Box child widgets
  are added directly to the Fl_Scroll widget.

  Please define USE_GROUP to 1 to see the bug
  and define USE_GROUP to 0 to see that it works okay

*/

#define USE_GROUP 1     // 0 works okay, 1 shows the bug

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Scroll.H>

#include <stdio.h>

#define SIZE (1600)
#define WIDTH (160)
#define HEIGHT (25)

int main(int argc, char **argv)
{
  char text[40];
  Fl_Double_Window *win = new Fl_Double_Window (250,320,"Scrolling test");
    win->begin();
    Fl_Scroll *scroll = new Fl_Scroll (20, 15, 200, 250);
    // scroll->type(FL_VERTICAL);
    scroll->box(FL_BORDER_BOX);
    scroll->begin();
#if USE_GROUP
    Fl_Group *g = new Fl_Group(21,15,180,SIZE*HEIGHT);
    g->box(FL_FLAT_BOX);
    g->color(FL_YELLOW);
    g->begin();
#endif
    int x = 23, y = 15;
    for (int i=0; i<SIZE; i++) {
      sprintf (text,"game %d",i);
      Fl_Box *b = new Fl_Box(x,y,WIDTH,HEIGHT);
      b->copy_label(text);
      b->box(FL_BORDER_BOX);
      y += HEIGHT;
    }
#if USE_GROUP
    g->end();
    printf("g=%p, g->resizable() = %p\n",g,g->resizable());
#endif
    scroll->end();
    printf ("max. y = %d\n",y);
  win->end();
  win->show(argc,argv);
  return Fl::run();
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to