Adding event handlers for Client Messages

Martin Serrer SERRER at nrcm3.nrc.ca
Fri Oct 26 01:55:00 AEST 1990


Hello IRIS Xperts,

  I am using the HP widget set on an IRIS 4D IRIX version 3.2.1 and trying to se
t up
an event handler for client message events.
  If I register the event handler for a push button widget things seem to work,
but
if I register it for a container widget such as XwrowCol or XwbulletinBoard
the event routine 'user_handler' is never called.
  By monitoring the event loop I can see that the ClientMessage is received in b
oth
cases. Am I missing something??

----------------------register event handler code fragment------------------

        panel_widget = XtCreateManagedWidget("panel",
                        XwrowColWidgetClass, toplevel, NULL, 0);

        XtSetArg(wargs[0], XtNlabel, "Fire");
        fire_button = XtCreateManagedWidget("fire",
                         XwpushButtonWidgetClass, panel_widget, wargs, 1);

/******* this one works ******/
        XtAddEventHandler(fire_button, NoEventMask, True,
                        user_handler, NULL);

/******* this doesn't work *******/
/*        XtAddEventHandler(panel_widget, NoEventMask, True,
                        user_handler, NULL);
*/     while(TRUE)
         {
                XEvent event;
                XtNextEvent(&event);
               if(event.type == ClientMessage)
                { printf("Client Message event received\n"); }
                XtDispatchEvent(&event);
         }

--------------- XSendEvent code fragment----------------------

        target_display = XtDisplay(a_widget);
        target_window = XtWindow(a_widget);

/* Build the Client message event data structure */

        user_event.display = target_display;
        user_event.window = target_window;
        user_event.type = ClientMessage;
        user_event.format = 32;
        user_event.message_type = USER_MESSAGE_TYPE;

        XSendEvent(target_display, target_window, TRUE,
                        XtAllEvents, &user_event);
-------------------------------------------------------------------------

  Thanks in advance for any help.

+-----------------------------------------------------------------------------+
| Martin Serrer                           Systems Lab., Bldg. M2, Montreal Rd.|
| 613-993-9442                            National Research Council of Canada,|
| serrer at syslab.nrc.ca                    Ottawa,  Ontario,  Canada  K1A-0R6  |
+------------------- Software Rusts, Rust never Sleeps -----------------------+



More information about the Comp.sys.sgi mailing list