home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.windows.x:18966 comp.windows.x.motif:7367 comp.windows.x.apps:1454
- Newsgroups: comp.windows.x,comp.windows.x.motif,comp.windows.x.apps
- Path: sparky!uunet!think.com!ames!saimiri.primate.wisc.edu!relay!nswc-wo.nswc.navy.mil!rchui
- From: rchui@nswc-wo.nswc.navy.mil (Raymond Chui)
- Subject: Why KeyPress/Release not work in DrawingAreaWidget?
- Message-ID: <1992Nov10.163148.19985@relay.nswc.navy.mil>
- Sender: news@relay.nswc.navy.mil
- Organization: Naval Surface Warfare Center - White Oak
- Date: Tue, 10 Nov 1992 16:31:48 GMT
- Lines: 74
-
-
- I am writing a Motif program, I try do some sample as following:
-
- ....
- ....
- drawing_a = XtVaCreateManagedWidget("drawing_a",
- xmDrawingAreaWidgetClass, sw, /* scroll widget */
- ....
- ....
- NULL);
- XtAddCallback(drawing_a, XmNinputCallback, input, NULL);
- ......
- ......
-
- void input(widget, data, cbs)
- Widget widget;
- XtPointer data;
- XmDrawingAreaCallbackStruct *cbs;
- {
- XEvent *event = cbs->event;
- .....;
- .....;
-
- if (cbs->reason == XmCR_INPUT) {
- switch (event->xany.type) {
- case ButtonPress:
- printf("got a buttonpress\n");
- break;
- case ButtonRelease:
- printf("got a buttonrelease\n");
- break;
- case KeyPress:
- printf("got a keypress event\n");
- break;
- case KeyRelease:
- printf("got a keyrelease event\n");
- break;
- default:
- ;
- break;
- } /* end switch */
- } /* end if */
- } /* end function */
-
- This only work for ButtonPress/Release, but not KeyPress/Release, why?
-
- If you see O'Reilly volume 6 "Motif Programming Manual" page 339
- Table 10-1 "Callback Reasons and Event Types"
- You will see:
-
- Callback cbs->event->xany.type cbs->reason
- -------------------------------------------------------------------
- XmNinputCallback ButtonPress, ButtonRelease, XmCR_INPUT
- KeyPress, KeyRelease
-
- Can someone out there explain to me why the KeyPress/Release are
- not work for me? Do I missing something? Why the ButtonPress/Release
- are work for me?
- Thank you in advance!
-
- --
- Raymond H. Chui
- NSWC N62
- 10901 New Hampshire Ave.
- Silver Spring, MD 20903-5000
- U.S.A.
- Voice:1-301-394-5192 Fax:1-301-394-5835
- E-Mail:rchui@nswc-wo.nswc.navy.mil
- _ __ _ , __
- ' ) ) / ' ) / / ) /
- /--' __. , , ____ ______ __/ /--/ / /_ . . o
- / \_(_(_(_/_/) ) )_(_) /) )_(_(_ / ( o (__/ / /_(_/_(_
- /
- '
-