home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!spool.mu.edu!sgiblab!nec-gw!nec-tyo!wnoc-tyo-news!scslwide!wsgw!wsservra!daemon
- From: rchui@nswc-wo.nswc.navy.mil (Raymond Chui)
- Newsgroups: fj.mail-lists.x-window
- Subject: Why KeyPress/Release not work in DrawingAreaWidget?
- Message-ID: <1992Nov17.140518.22322@sm.sony.co.jp>
- Date: 17 Nov 92 14:05:18 GMT
- Sender: daemon@sm.sony.co.jp (The devil himself)
- Distribution: fj
- Organization: Naval Surface Warfare Center - White Oak
- Lines: 79
- Approved: michael@sm.sony.co.jp
-
- Date: 10 Nov 92 16:31:48 GMT
- Message-Id: <1992Nov10.163148.19985@relay.nswc.navy.mil>
- Newsgroups: comp.windows.x,comp.windows.x.motif,comp.windows.x.apps
- Sender: xpert-request@expo.lcs.mit.edu
-
-
- 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 (__/ / /_(_/_(_
- /
- '
-