Path: utzoo!attcan!uunet!mcsun!ukc!tcdcs!swift.cs.tcd.ie!cjmchale From: cjmchale@swift.cs.tcd.ie Newsgroups: comp.windows.x Subject: Re: How do I simulate Command button event? Message-ID: <7087.26eea125@swift.cs.tcd.ie> Date: 12 Sep 90 20:57:09 GMT References: <1990Sep11.095335@sarek.Berkeley.EDU> Organization: Computer Science Department, Trinity College Dublin Lines: 37 In article <1990Sep11.095335@sarek.Berkeley.EDU>, mh2620@sarek.Berkeley.EDU (Mark Horstman [235-3417]) writes: > I'm trying to simulate a button press/release event in a Athena Command > widget but can't seem to get it to work. I'm using XSendEvent. Do I > have to fill the whole XButtonEvent structure? Do I have to send a > press event followed by a release event or can I just send the release > event? I think this belongs on the frequently asked questions posting :-( It is very likely that you're not setting the "window" field in the event before using XSendEvent(). The event is getting sent to the correct application and then Xt says to itself "I don't have any widget whose window id matches that in this event structure" so it simply (and silently) throws away the offending event. If you're sending events to your own application (and it sounds like you are) then you can use XtDispatchEvent() instead. This is more efficient that XSendEvent() since everything is done locally (i.e, you're avoiding a round trip to the X server). If using XtDispatchEvent() then (as for XSendEvent()) remember to set the "window" field in the event before using XtDispatchEvent(). > | Mark A. Horstman Southwestern Bell Telephone | > | mh2620@sarek.sbc.com St. Louis, MO | > | OR uunet!sarek.sbc.com!mh2620 (314) 235-3417 | > +----------------------------------------------------------------------------+ Regards, Ciaran. -- Ciaran McHale Department of Computer Science, Trinity College, Dublin 2, Ireland. Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie or cjmchale%cs.tcd.ie@cunyvm.cuny.edu My opinions are mine but you can share them too if you want.