MacArthur, Ian (SELEX GALILEO, UK) wrote:
>> I tried to make an image browser with Fl_Scroll and Fl_Button.
>> My code : http://nopaste.info/2b8b92cf0c.html
>> When i choose a directory, i call the loadDirectory function
>>
>> gui->window is the Fl_Double_Window
>>
>>
>> My problem : the Fl_Scroll isn't redrawn when i click on the 
>> scrollbar. I have to iconify the application to get redrawn.
>>
>> I tried to add a callback on change, but the callback isn't called.
>>
>> Do you have any idea?
> 
> Maybe start by looking at the demos in the test folder, and at:
> 
> http://www.seriss.com/people/erco/fltk/#ScrollableImage 
> 
> Also the other examples there (on Greg's page) can be very useful.

        If you're having redraw problems with Fl_Scroll,
        the common cause is often the background not having a box.

        When you create the scroll, try setting the box() type to FL_FLAT_BOX
        (I think the default is FL_NO_BOX). So eg:

         scroll=new Fl_Scroll(x,y,w,h);
         scroll->type(5);
         scroll->box(FL_FLAT_BOX);


        Setting it to FL_FLAT_BOX will ensure the background is drawn
        'with something' instead of nothing.

        The only reason for FL_NO_BOX is if your widgets fill the scroll area,
        no time has to be wasted to calculate where to render a box that can't
        be seen. But in your case you might have areas not filled with your 
widget
        that need to be drawn, so it's best to have an FL_FLAT_BOX there.

        Also:

#         scroll=new Fl_Scroll(x,y,w,h);
#         scroll->type(5);
#         gui->scrollImages=scroll;
#         scroll->show();
#         scroll->redraw();
#         Fl::flush();

        Those last two commands don't do anything useful; when you show() the
        widget, that just /schedules/ it to be shown, it does not draw it right
        away, and Fl::flush() won't make it happen any faster, since it hasn't
        been drawn yet.

        And in this section:

#         if (nb > 0)
#                 scroll->end();
#         gui->window->redraw();
#         Fl::flush();

        I would think you'd want to *always* end() the scroll, and not
        just when nb > 0.

        Curious too why you're deleting/recreating the scroll instead
        of just creating one scroll, and then clear()ing it whenever you
        want to change the contents. Might be easier/better.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to