T.R | Title | User | Personal Name | Date | Lines |
---|
1566.1 | take a look in examples conference | GSRC::WEST | Variables don't, Constants aren't | Fri Oct 13 1989 01:41 | 10 |
| RE: <<< Note 1566.0 by FIRBRD::POMERANTZ >>>
-< ClientMessageEvent Handling? >-
You might want to look in the DW_EXAMPLES conference.
(KP7 to select conference)
-=> Jim <=-
|
1566.2 | | PSW::WINALSKI | Careful with that VAX, Eugene | Fri Oct 13 1989 13:27 | 6 |
| Are you selecting events to examine using a mask? If so, you'll never see
ClientMessages because there isn't a mask for them. If you dispatch all events,
then you will see them.
--PSW
|
1566.3 | | SX4GTO::HOLT | Robert Holt ISV Atelier West | Sun Oct 15 1989 22:25 | 27 |
|
You need to declare a message handler.
Heres how I do it:
void message_handler();
XtActionsRec msgActions[] =
{
{"message_handler",(XtActionProc)message_handler},
{ NULL }
};
static int numMsgActions = sizeof(msgActions) / sizeof(XtActionsRec);
static String msgTranslationsSrc = "<Message>: message_handler()";
XtTranslations msgTranslations;
/* Then inside your program: */
XtAppAddActions(context,msgActions,numMsgActions);
/*Then when you set up your main window:*/
XtSetArg(arglist[count],DwtNtranslations,msgTranslations);count++;
For a sample message handler, see
tiglth::/usr/users/guest/hard_copy.c,send_message.c
|
1566.4 | Sometimes I feel like I'm coming from outer space | DECWIN::KLEIN | | Mon Oct 16 1989 15:46 | 39 |
| I suggest another approach based on XtAddEventHandler.
Another way to declare a handler for client messages is to put the single line:
XtAddEventHandler (w, 0, 1, ClientMessageHandler, closure);
in your main program (after creating "w", the widget that is receiving the
messages). Use "closure" as the opaque callback closure value.
Then, use following handler routine (template) to process the client events:
static void ClientMessageHandler(w, closure, eventP)
Widget w;
Opaque closure;
XEvent *eventP;
{
XClientMessageEvent *clientEventP = eventP;
/* Ignore other non-maskable events. Events like GraphicsExpose
* will also be dispatched to this event handler by the Xt intrinsics. */
if (eventP->type != ClientMessage) return;
/* Process client message based on message_type atom values.
* (Register all message_type atoms using XInternAtom to maintain
* modularity.) */
switch (clientEventP->message_type) {
case MyMessage1Atom : /* put your code here */ break;
case MyMessage2Atom : /* put your code here */ break;
/* ... */
default: break;
}
}
----------------------------------------------------------------------
-steve-
|