Hi guys,
Can anyone help me with this Fl_Scrollbar issue?
- I have a window of size 100x100
- Bellow the windows I have a scrollbar of width = 100
- In my windows I need to draw an object of size 125
- For simplicity the object remembers of how much it was scrolled
- My goal is to have the scroll bar display the correct amount of free
space to execute the correct scrolling
I've written a function to set the correct value() to the scroll bar
every time a scroll is done or when the object change it's size:
void window::fixScrollbars()
{
const size_t rw = w()
const size_t dw = object->width();
if(dw)
{
if(dw>rw)
{
scrollH_->activate();
// I know there is something wrong here, but what?
scrollH_->value(0,rw,document_->scrollH(),dw);
}
else
{
scrollH_->deactivate();
}
}
else
{
scrollH_->deactivate();
}
redraw();
}
The callback method for the scrolling looks like this:
void window::scrollCB(Fl_Widget *w,void *m)
{
window *me = static_cast<window *>(m);
int v = me->scrollH_->value();
me->document_->scrollH(-v);
me->fixScrollbars();
}
The worst part is that is seems to work a little bit, if I click on the
small arrow of the scroll bar
only one time, I get exactly the expected behavior, but after the
initial click the scroll doesn't
change anymore.
If I try sliding the slider or clicking in the empty space, I get very
strange scrolling
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk