Re: Do we have scrolled canvases yet?

Steve Lamont (
Sun, 12 Jan 97 09:47:34 PST

To subscribers of the xforms list from (Steve Lamont) :

> When you say "activate" handler, do you mean a handler to handle
> the Expose event? I got my hands on this really thick book published by
> Digital Press called _X Window System: C Library and Protocol Reference_,
> and under the part about "Events", they did not list any kind of
> "activate" event (at least, it wasn't called that). And the XForms manual
> does mention an "Expose" event. So I'm guessing it's the Expose event I
> need to handle, right?

Nope. The activate handler is assigned using fl_modify_canvas_prop(),
an XForms function. This handler is called by XForms when the Canvas
Window is created. It is at this point you should create your child
Window. Refer to the XForms manual for further details.

BTW, while the Digital Press book on X is okay, I'd look a the
O'Reilly and Associates series on X, especially Vol I and Vol II (the
Xlib Programmer's [tutorial] and Reference [man pages] manuals).

> How do you draw to the child window created with XCreateWindow()?
> Do I use the XForms routines or the XLib ones?

You can use either or some other graphics API that will draw to a
Window, such as OpenGL/Mesa or PEX. To use XForms drawing functions,
refer to the fl_winset() function in the manual. Careful, however
since your Window may have a different Visual than the parent (XForms)
Window. You may need to be clever about this.

> > You'll probably need to register an event handler, too.
> > Use XMoveWindow() to reposition the child window when scrolling.
> And about scroll bars ... there doesn't seem to be an explicit
> scroll bar class in XForms. Right now, I'm implementing scroll bars by
> just using horizontal and vertical sliders. I have buttons with arrows as
> labels (using @> strings) on them placed at the ends of the sliders.

Sorry -- I misspoke if I referred to Scroll Bars. Of course, I meant
Sliders. I tend to use the terms interchangably, which is incorrect.

Sounds as if you're on the right track.