Button release after button is insensitive

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
Button release after button is insensitive

Submitted by jwobido on Tue, 12/19/2006 - 22:21. General Questions
I have a spring loaded push button on my application. If the software deems it necessary, it will cause the push button to go insensitive via a call to XtSetSensitive. This may or may not happen while the user has the button depressed.

In the event the button is depressed, and the widget goes insensitive, the widget is still shaded such that it appears the button is depressed -even after releasing the mouse. I can't seem to get a "button release" callback to invoke.

I tried to send an event to release, but it didn't seem to work.

XButtonReleasedEvent event;
XSendEvent( XtDisplay( btn_widget ), XtWindow( btn_widget ), false,
ButtonReleaseMask, ( XEvent * )&event );

Does anyone have any ideas how to force the widget to appear as though the user has released the mouse?

Thanks.

fredk

In almost all circumstances, you should only act when the pushbutton is released, not when it is pressed.
To do this, you should be using the XmNactivate callback, not the arm or disarm callbacks.
If you use an activate callback, your problem goes away.

And this code is wrong:
XButtonReleasedEvent event;
XSendEvent( XtDisplay( btn_widget ), XtWindow( btn_widget ), false,
ButtonReleaseMask, ( XEvent * )&event );

You would need to fill in the fields of "event" before passing it to XSendEvent().
I'm surprised this did not crash.
--
Fred K