I have little problem with scrollbar.
The problem is there is no separator anymore if i move the scrollbar back to the top again.
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Box.H>
#define BW 200 //box width
#define BH 50 //box height
#define SEP 10 //separator
int main(){
Fl_Window win(500, 300);
Fl_Scroll *scr=new Fl_Scroll(10,10,win.w()-20,win.h()-20);
scr->color(FL_GREEN);
int col=scr->w()/BW;
int c=0,line=SEP;
for(int i=1;i<=20;i++){
Fl_Box *b = new Fl_Box(scr->x()+SEP+(c*(BW+SEP)),scr->y()+line,BW,BH);
b->box(FL_FLAT_BOX);
b->color(FL_RED);
c += 1;
if(c == col){
c = 0;
line += (BH + SEP);
}
}
new Fl_Box(SEP,scr->y()+line-SEP,SEP,SEP);
win.show();
return Fl::run();
}
Thanks.
Can't really tell what the reason is for that behaviour but
If a box is added before the loop, it doesn't lose the top line
new Fl_Box(SEP,0,SEP,SEP);