imacarthur wrote:
> Gents,
> 
> I've never really used Fl_Scroll much, the data I've been rendering 
> never seemed to lend themselves to it so I've always just created my own 
> scrolling area using Fl_Scrollbar and some work in the draw method.
> 
> However, this evening I thought I had a problem that might suit an 
> Fl_Scroll, but I can't seem to make it work the way I want.
> 
> So... what I want is a drawing area that resizes horizontally as I drag 
> the window (there is no horizontal scrollbar). As the image reflows 
> horizontally, the vertical dimension will change, so a vertical 
> scrollbar might appear/disappear at some point, and size/position itself 
> to reflect the state of the reflowing image area...
> 
> Is there some neat way to use Fl_Scroll to do that, or should I just 
> revert to my existing approach, of using Fl_Scrollbar and doing the 
> layout/sizing/positioning myself?
> 
> Thanks in advance...

Yes, I think so. If I understand you correctly, then you would have,
let's say, a Fl_Window w, a Scroll s, and one child widget in the
Scroll, your Image i. Your Scroll class would be derived from
Fl_Scroll, your Image class maybe from Fl_Image.

Fl_Window w(800,600);
Scroll s(0,0,800,600);  // full window size
Image i(0,0,800,800);   // bigger than Scroll s !
s.end;
w.end;
w.resizable(s);
w.show();
Fl::run();

Let's suppose, your Image is a square (same width and height). In
your Scroll class, you can implement the virtual resize() method:

Scroll::resize(int X, int Y, int W, int H)
{
   Fl_Scroll::resize(X,Y,W,H);          // resize Scroll widget
   scroll_to(0,0);                      // makes things easier; YMMV
   img->resize(X,Y,max(W,H),max(W,H));  // or something like that
}

where *img is your Image i.

Thus, the Image i would always fill the full Scroll area, and
horizontal and vertical scrollbars would appear as needed.

Of course, your Image class would need to be able to resize
itself accordingly.

Is that what you want to do?

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to