[comp.windows.x.motif] Label in widget not updating.

E_CMA@vaxa.nerc-murchison.ac.uk (04/29/91)

Re: Label Widget, not updating - Help needed.

 I think the problem is coming about because of your secondary event loop,
 the poor thing is getting confused! The solution would seem to be to 
 treat it as an inter-client communication problem. i.e.

 If all that the secondary loop is doing is watching your socket, you might
 be able to get rid of it.

 Try setting up an Atom in main() on your root window (or any other window
 if you are within the same application, set a property for it when your 
 socket has done its stuff using XChangeProperty, 
     add 

      XSelectInput(XtDisplay(toplevel),root, PropertyNotifyMask);
                                       (^ or window, could be the window
                                          of your Label widget)

      to main(), 

 and modify your main loop to 

 while(TRUE)
 {
    XtNextEvent(&event);
    switch (event.type)
    {
     case PropertyNotify:
     if(event.xproperty.window == root &&
        event.xproperty.atom == MY_ATOM_NAME)
        XtSetArg(a[0],XmNlabelString, message);
        XtSetValues(my_label,a,1););
    }
 }
 If in doubt, stick to the root.
 You could even set off the property change from the originating client
 by defining an atom on the root with the same name.

 For a full example of this sort of thing, see Young's book, "The X Window
 System, Programming and Applications, OSF/Motif Edition" ch 11.

 I have used this method for passing status info from spawned clients. 
 The label widget has never failed to display properly.
 
*************************************************************************
* Snailmail:		    *  E_Mail	                                *
*			    *  CBS%UK.AC.NERC-MURCHISON.VAXA::E_CMA     *	
* Dr C.M.Allen		    *  JANET: e_cma@uk.ac.nmh.va                *
* British Geological Survey *                                           *
* Murchison House           * 	                                        *
* West Mains Road           *                                           * *************************************************************************
* Edinburgh                 * Tel: 031-667-1000 x277 from U.K.		*
* Scotland                  * 						*
* EH9,3LA                   * 						*
*************************************************************************