[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1566.0. "ClientMessageEvent Handling?" by FIRBRD::POMERANTZ () Thu Oct 12 1989 21:36

    We are having some problems getting ClientMessage to work. Does anyone have
    any working examples of a ClientMessageEvent sender and receiver. Our problem is t
    Our problem is that the receiver never appears to see the
    ClientMessageEvent although it apeears to be sent ok with XSendEvent.
    Any light on where the problem might be would be much appreciated
    although I know that without the code that's hard to do.
    
    

T.RTitleUserPersonal
Name
DateLines
1566.1take a look in examples conferenceGSRC::WESTVariables don't, Constants aren'tFri Oct 13 1989 01:4110
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.2PSW::WINALSKICareful with that VAX, EugeneFri Oct 13 1989 13:276
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.3SX4GTO::HOLTRobert Holt ISV Atelier WestSun Oct 15 1989 22:2527
            
   
 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.4Sometimes I feel like I'm coming from outer spaceDECWIN::KLEINMon Oct 16 1989 15:4639
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-