> > On 09/27/12 10:47, Eric Sokolowsky wrote:
> > > I'm using FLTK 1.3.0 and have a list of widgets in a Fl_Pack. This 
> > > Fl_Pack is inside a Fl_Scroll. When I add a new item to the Fl_Pack I 
> > > want the item to be visible right away, scrolling if necessary. Is there 
> > > a way to do this easily, or do I have to figure out where the new item is 
> > > and if offscreen figure out how much to adjust the scrollbar. I tried 
> > > using the latter method but the screen does not update right after the 
> > > item is inserted until I move the cursor again, even if I put the code to 
> > > update the scrollbar position at the beginning of my Fl_Scroll's draw() 
> > > function.
> >
> >     When you add the item to the pack, position the scroller,
> >     then call the parent window's redraw() method, eg. 
> > scroll->window()->redraw();
> >     and see if that does it.
> >
>

After trying a few more things I found a recipe that seems to work, but it is a 
bit of a kludge. At the end of my class's draw() function (this is the class 
that derives from Fl_Scroll, and has a Fl_Pack as a member) I check to see if 
the window needs to scroll, and if it does, I recursively call the draw 
function just once. I think that the widget's position is not updated until 
sometime in the draw() code so perhaps I need to just find where that is done 
and put my scroll check right after that to see if I can avoid the recursive 
draw() call.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to