[comp.windows.x.motif] Drawing area with mouse move callback ?

chiu@efi.com (Chan Chiu) (10/23/90)

I need a canvas area for my graphics editor area. Looks like drawing
area widget is intened for such use. However, I find out drawing
area doesn't support mouse drag callback. 

Mouse drag is essential for Mac style bounding box selection. Can I still
use drawing area with some patches ? Or, do I use a customized widget
(or Xt, Xlib nonwidget solution) ?

Thanks.

/CC

db3l@ibm.com (David Bolen) (10/23/90)

In article <1990Oct22.232454.224@efi.com> chiu@efi.com (Chan Chiu) writes:

>Mouse drag is essential for Mac style bounding box selection. Can I still
>use drawing area with some patches ? Or, do I use a customized widget
>(or Xt, Xlib nonwidget solution) ?

I also use a XmDrawingArea widget as my primary window area, and just add
a normal X event handler for mouse movement, using XtAddEventHandler for
the widget with a mask of PointerMotionMask.  I use the XmNinputCallback
for button and keyboard input.

-- David
--
/-----------------------------------------------------------------------\
 \                             David Bolen                             /
  |    Laboratory Automation, IBM Thomas J. Watson Research Center    |
 /              P.O. Box 218, Yorktown Heights, NY  10598              \
| - - - - - - - - - - - -  M i t h r a n d i r  - - - - - - - - - - - - |
| Internet : db3l@ibm.com                    | Bitnet : db3l@yktvmv     |
| Usenet   : uunet!bywater!arnor!larios!db3l | Phone  : (914) 945-1940  |
\-----------------------------------------------------------------------/

klee@wsl.dec.com (Ken Lee) (10/23/90)

In article <1990Oct22.232454.224@efi.com>, chiu@efi.com (Chan Chiu) writes:
|> I need a canvas area for my graphics editor area. Looks like drawing
|> area widget is intened for such use. However, I find out drawing
|> area doesn't support mouse drag callback. 
|> 
|> Mouse drag is essential for Mac style bounding box selection. Can I still
|> use drawing area with some patches ? Or, do I use a customized widget
|> (or Xt, Xlib nonwidget solution) ?

XtAddEventHandler will give you a mouse motion callback on any widget.
You can also use the <Motion> translation table entry.

Still, in the long run you'll probably be better off writing your own
widget to do your graphics.  The Motif window widget is intended for
quick upgrades of Xlib (or similar) programs to Motif.  Your own widget
will give you much more flexibility, including full access to the X
Toolkit resource, geometry, translation, and subclassing mechanims.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee