|
|
On Apr 30, 2006, at 3:03 PM, Anonymous wrote:
Thanks for your advices but the thing is I derived my own class
from Fl_box in order to display text lines (with the drawing
functions) the way I want to .
So I need to know how can I make the scrollbar interact with my own
class and the other way around.
Can you help me ?
You can either put your own FlBox inside an Fl_Scroll, or create a
scrollbar and move the box (or the text in the box) according to the
scrollbar's callbacks.
1: take a look at the "test/scroll" example. It shows how to set up
the Fl_Scroll group and how to add items inside, including a self-
drawn widget
2: you can do the interaction between the scrollbar and your widget
yourself. You need to send data in both directions: whenever the
number of text lines in your text widget changes, you must change the
range in the Fl_Scrollbar. The help pages for "int Fl_Scrollbar::value
(int position, int size, int top, int total)" explain it pretty
straight forward. You also need to handle the other direction, the
user moving the scroll bar. Here you need to set up a callback for
the Fl_Scrollbar. Whenever the callback is called, change the top
line that is displayed in your text box accoring to
Fl_Scrollbar::value() and call TextBox::redraw().
Matthias
----
http://robowerk.com/
[ Direct Link to Message ] | |
|
| |