randy@umn-cs.CS.UMN.EDU (Randy Orrison) (12/20/88)
In article <8812162154.AA02843@EXPO.LCS.MIT.EDU> rws@EXPO.LCS.MIT.EDU (Bob Scheifler) writes: > What kind of Widget should I use to draw on, and how do I do it? >In the HP widget set, you can use the WorkSpace widget. Works great! > The thing that bothers me is that this error does not occur > at the time of the XDrawRectangle call, but later. >That's because of the asynchronous nature of X. If you can >run your application with -synchronize, it would have happened >at the time of the call. When I switched over to the WorkSpace widget, I noticed a callback XtNexpose which I attached my drawing routine to, thereby solving the above mentioned problem, as well as another one I came up with - how do I get my picture re-drawn when it's exposed. So far, everything is wonderful. Now, the new question: I've attached a routine to the XtNselect callback which gets called when a button is pushed. How do I tell where the pointer is within my widget when this happens, and how do I tell what button was pushed? (I'm willing to bet that these two questions have almost the same answer, but I can't find it...) Thnaks to all who responded to my previous question! -randy -- Randy Orrison, Chemical Computer Thinking Battery -- randy@cctb.mn.org (aka randy@{ux.acss.umn.edu, umn-cs.uucp, umnacca.bitnet, halcdc.uucp}) "Stealing a rhinoceros should not be attempted lightly."
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/20/88)
How do I tell where the pointer is within my widget when this happens, and how do I tell what button was pushed? Look at the Intrinsics documentation on callbacks (e.g. Section 5.1 in the HP documentation). The third argument to the callback, call_data, will for the case of the XtNselect callback be the triggering X event; you can look inside the event for the button number and the pointer position. I couldn't directly find the call_data documented in the HP stuff, I peeked at the source.