[comp.windows.x] How to get Canvas from Xv_Window in XView?

denault@hale.ifa.hawaii.edu (Tony Denault) (08/17/90)

Using the XView toolkit, how can I obtain the Canvas from
within the event_proc();

I have a procedure to handle events into a canvas. This
procedure services  4 Canvases used in my application.
The event_proc() parameter are defined as:

void event_proc( window, event)
  Xv_Window  window;
  Event      *event;

How do I get the Canvas from the Xv_Window data structure? 
Is their a way?

Thanks in advance.
Tony D.

--
/------------------------------------------------------------------------\
| Tony Denault, Institute for Astronomy,  |  denault@hale.ifa.hawaii.edu |
| 2680 Woodlawn Drive, Honolulu, HI 96789 |               (808) 956-6097 |
\------------------------------------------------------------------------/

dmaustin@vivid.sun.com (Darren Austin - They are laughing AT me, not with me) (08/17/90)

In article <9039@uhccux.uhcc.Hawaii.Edu> denault@hale.ifa.hawaii.edu (Tony Denault) writes:
   Using the XView toolkit, how can I obtain the Canvas from
   within the event_proc();

   I have a procedure to handle events into a canvas. This
   procedure services  4 Canvases used in my application.
   The event_proc() parameter are defined as:

   void event_proc( window, event)
     Xv_Window  window;
     Event      *event;

   How do I get the Canvas from the Xv_Window data structure? 
   Is their a way?

The Xv_Window is the paint window of the canvas, so you can do
the follow to get a handle to the canvas that it belongs to:

	canvas = (Canvas)xv_get(window, CANVAS_PAINT_CANVAS_WINDOW);

Cheers,
--Darren
--
Darren Austin                         |  Enough with safe and sane,
XView Technical Staff		      |    It's time for dumb and 
Sun Microsystems, Mountain View       |          dangerous!
dmaustin@sun.com	              |

fgreco@govt.shearson.COM (Frank Greco) (08/18/90)

Tony,


>Using the XView toolkit, how can I obtain the Canvas from
>within the event_proc();
>
>I have a procedure to handle events into a canvas. This
>procedure services  4 Canvases used in my application.
>The event_proc() parameter are defined as:
>
>void event_proc( window, event)
>  Xv_Window  window;
>    Event      *event;
>
>    How do I get the Canvas from the Xv_Window data structure?
>    Is their a way?


The first argument in the event_proc for a Canvas is the canvas that
belongs to the event_proc, and its value is the canvas in which 
the event took place.

In other words, given your example, the value of "window"
is the value of the canvas in which the event took place.

Frank G.