Re: Do we have scrolled canvases yet?

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 6 Jan 97 07:20:10 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> > A scrolled canvas is (relatively) easy to implement for yourself,
> > though. [...]
>
> Can you or somebody else on the list please post an example?

Unfortunately, I can't post my scrolled Canvas code -- it's just
toooooo ugly -- I wrote it when I was just starting playing with
XForms under version 0.75, I think, and there are a myriad of now
quite embarrassing kluges. Of course since it "works" (though I don't
really know *how*) I've never taken the time to clean it up and do
things right.

The concept is pretty simple though. Basically just follow the
cookbook instructions in the XForms manual to create a Canvas and
register an activate handler (and possibly an init and cleanup
handler, if necessary) with fl_modify_canvas_prop(). In the activate
handler, get the Window of the Canvas with fl_get_canvas_id() and then
use XCreateWindow() to create a child. That child can be as large as
or larger than the parent (Canvas) window. Map the window with
XMapWindow(). That's about it for creation.

You'll probably need to register an event handler, too.

Use XMoveWindow() to reposition the child window when scrolling.

spl