Re: Do we have scrolled canvases yet?

Carnage (S566@aacci.aacc.cc.md.us)
Sun, 12 Jan 1997 18:06:18 -0500 (EST)

To subscribers of the xforms list from Carnage <S566@aacci.aacc.cc.md.us> :

On Sun, 12 Jan 1997, Steve Lamont wrote:

> 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.

Ok ... in my Activate routine, I use XCreateWindow() to create a
window like you suggested. Here's how I did it:

childCanvas = XCreateWindow(fl_get_display(), fl_get_canvas_id(ob),
0, 0, 200, 200, 1, CopyFromParent,
CopyFromParent, CopyFromParent, 0, NULL);
childGC = XCreateGC(fl_get_display(), childCanvas, 0, 0);

childCanvas and childGC are defined outside the Activate routine (i.e.
they're global).

I made a wild guess as to how I'm supposed to obtain the GC value
for the XLib drawing routines I want to use. Did I do that part right?

I also made a wild guess as to what the last five arguments for
XCreateWindow() should be.

I then do a XMapWindow(fl_get_display(), childCanvas) as was
suggested.

However, doing any drawing routines (i.e.
XFillRectangle(fl_get_display(), childCanvas, childGC, 10, 10, 100, 100))
yields no results! I can't get any of the drawing routines to draw to
childCanvas. (Do I need to call XMapWindow() to refresh the window after
every drawing/write operation, like you do in console mode using NCurses?
Anyway, I tried that also, but that was also a dead end.)

I obviously screwed the creation of childCanvas up. Or perhaps
I'm specifying the incorrect arguments to the drawing routines? Could
you please tell me what I did wrong?


Also ... I noticed when I XMapWindow()'d childCanvas, the XForm
canvas (the "parent canvas" if you will) no longer generated Expose
events. Is this because childCanvas completely covers the parent canvas?
I made childCanvas smaller (smaller than the parent canvas) to test that
hypothesis out, and when I did that Expose events were generated again.
Since I'm probably going to ask the following question eventually, I
better ask it now: how do I get childCanvas to pass on Expose events to
the parent canvas so that it's Expose handler can get called?

Thanks!

==============================================================================
Arcadio Alivio Sincero, Jr.
Undergraduate Computer Science Major/Linux Enthusiast/Competitive Bodybuilder
email: S566@aacci.aacc.cc.md.us
WWW: /cgi-bin/exit-to?http://www.geocities.com/SiliconValley/Pines/5181

"Bare feet magnetize sharp metal objects so they point upward from the floor,
especially in the dark."