| My understanding is that the activate callback in the SText widget is a stub.
It is not used in the code but is available for user-defined translations,
so that an SText widget that has its translations augmented has a convenient
hook for generating a callback without the user having to write a new action
routine. You do not want to get involved in this, I would say. There are
easier ways to do what you want.
Normally, MB2 activates a popup menu, not a popup dialog box. I'll assume
you meant "menu". If you really meant dialog box, you can still use the same
general approach.
First, use XtAddEventHandler to trap MB2 on the SText widget. Make these
calls once, after realizing the main window that contains the sText widget.
Because of a toolkit restriction, the popup menu cannot be fetched until
its parent has been realized:
DwtFetchWidget (drmHierarchy, "myPopupMenu", sTextW, &popupMenuW, &class);
XtAddEventHandler (sTextW, ButtonPressMask, 0, ButtonPressHandler,
popupMenuW);
and then write a ButtonPressHandler like this, to activate the menu:
static void ButtonPressHandler(w, popupMenuW, eventP)
Widget w, popupMenuW;
XButtonEvent *eventP;
{
if (eventP->button != Button2) return; /* wrong button */
DwtMenuPosition (popupMenuW, eventP); /* position the menu */
XtManageChild (popupMenuW); /* pop it up */
}
...
-steve-
|