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

[STR Active]

Link: http://www.fltk.org/str.php?L2304
Version: 1.3-current
Fix Version: 1.3.0 (r7883)


Sigh, reopening :-(

Although the fix is correct WRT clipping, there's another bug when drawing
the *BIG* Fl_Group's box. The yellow background isn't drawn everywhere, and
the bottom border isn't drawn correctly. There are drawing artefacts when
scrolling to the bottom.

See attached file scroll_1a.cxx.


Link: http://www.fltk.org/str.php?L2304
Version: 1.3-current
Fix Version: 1.3.0 (r7883)
/*
  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();
    Fl_Box *b1 = new Fl_Box(20,15,3,3); // top left in Fl_Scroll
    b1->box(FL_FLAT_BOX);
    b1->color(FL_RED);
#if USE_GROUP
    Fl_Group *g = new Fl_Group(24,15,180,SIZE*HEIGHT+4);
    g->box(FL_DOWN_BOX);
    g->color(FL_YELLOW);
    g->begin();
#endif
    int x = 28, 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
    Fl_Box *b2 = new Fl_Box(20,y+5,3,3);        // bottom left in Fl_Scroll
    b2->box(FL_FLAT_BOX);
    b2->color(FL_GREEN);

    scroll->end();
    printf ("max. y = %d\n",y);
  win->end();
  win->resizable(win);
  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