Alvin wrote:
>
> My solution is to hooking my own scrollbar callback into
> Fl_Scroll::hscrollbar and Fl_Scroll::scrollbar. Before doing so, I save the
> pointer to their original callback (set by Fl_Scroll's ctor). Then in my
> callback, I call the scrollbar's original callback then do my stuff.
...
> Basically, the last line is what I needed to do. However, to determine how
> much the scroll was changed, I need to know the before and after values.
...
>
> Anyone have any other ideas that would be cleaner that this?
You may try to implement the (virtual) resize() method for a widget
that lives in your scroll area, something like:
SomeWidget::resize(int X, int Y, int W, int H) {
int dx = x() - X;
int dy = y() - Y;
...
Fl_Widget::resize(X,Y,W,H); // allow position and size update
// do things dependent on size/pos. change dx,dy,...
}
FLTK 1 calls the resize() method before actually changing the widget
(and you can even _override_ the requested positions, but that would
not be what you want). Therefore you must call Fl_Widget::resize()
or your base classes resize() method, if there is one (e.g.
Fl_Box::resize(), if SomeWidget is derived from Fl_Box).
I don't know, if this works, if your SomeWidget isn't in the visible
area, but you could always use an invisible small box and reposition
it into the visible area, if this would be needed.
I'm using this since some time successfully (I'm even overriding
the positions for some resize() events).
HTH
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk