How do set up callbacks so different buttons cause different results. I want to make it so if I press the right mouse button on a push button widget, it will give a different effect than pressing the left mouse button. can anyone help? |
|||
|
User login |
|
|
All trademarks and copyrights on this page are properties of their respective owners. The rest is copyright © Integrated Computer Solutions Inc., 2003 - 2012 |
Anonymous
Push Buttons...probably a simple question
Short answer Create an activate callback for it.
Long answer I strongly suggest that if you are having problems with this, that you download an evaluation copy of BX as advertised on this site so that you can get a feel for what the widgets do, especially the layout widgets.
Also available online at www.ics.com and with BX is the manuals and tutorials that will show from point zero how to get a Motif application off the ground.
Besides all that, playing around with BX is a heck of a lot of fun,
Good luck!
- Scorch
Anonymous
Push Buttons...probably a simple question
void pb_cb (Widget w, XtPointer client, XtPointer call)
{
XmPushButtonCallbackStruct *p = (XmPushButtonCallbackStruct)call;
switch (p->event->xbutton.button) {
case Button1 /* do button 1 stuff... */
break;
case Button2 /* do button 2 stuff... */
break;
case Button3 /* do button 3 stuff... */
break;
}
}
Anonymous
Push Buttons...probably a simple question
Whoops! XmNactivateCallback only triggers on BSelect. Duh. So you will need an event handler,
not a callback
/* register pb_eh as handler for pb_w */
XtAddEventHandler (pb_w, ButtonPressMask, False, pb_eh, 0);
static void
pb_eh (Widget w, XtPointer client, XEvent *ev,
Boolean *continue_to_dispatch)
{
switch (ev->xbutton.button) {
case Button1 /* do button 1 stuff .. */
break;
...
}
}
Anonymous
Push Buttons...probably a simple question
Instead of a event handler, could you use an arm callback?
-scorch