|
|
Hello
It seems Fl_Scroll takes into account the position of the topmost leftmost widget among its children, where the docs state:``` Fl_Scroll scroll (10,10,200,200); Fl_Box b1 ( 10, 10,50,50,"b1"); // relative (x,y) = (0,0) Fl_Box b2 ( 60, 60,50,50,"b2"); // relative (x,y) = (50,50) Fl_Box b3 ( 60,110,50,50,"b3"); // relative (x,y) = (50,100) ```
a modified example from the docs: ``` #include <FL/Fl.H> #include <FL/Fl_Scroll.H> #include <FL/Fl_Button.H> #include <FL/Fl_Window.H> void btn_cb(Fl_Widget *w, void *data) { auto s = (Fl_Scroll*)data; s->scroll_to(0, 0); } int main() { Fl_Window win(400, 300); Fl_Scroll s(0, 0, 400, 300); Fl_Button b1(10, 10, 30, 30, "B1"); Fl_Button b2(60, 60, 30, 30, "B2"); Fl_Button b3(60, 110, 30, 30, "B3"); s.end(); win.end(); win.show(); b3.callback(btn_cb, &s); return Fl::run(); } ```
This makes the relative position of b1 (following the docs) be (10, 10), but using s.scroll_to(0, 0), actually appears to scroll to 10, 10, making the the first button appear at position 0, 0 of the window. To get the initial appearance, one would need to s.scroll_to(-10, -10). I could be misunderstanding the docs, or is the position of the topleft-most widget the reference for the Fl_Scroll?
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/ad324d91-17e6-4248-8a1c-68fd5eca4fdfn%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |