Motif/Xt: Trigger reconfiguration of a widget

Chris Sorenson csoren at cpinternet.com
Fri Oct 29 02:48:25 UTC 2021


> 
> Thanks for the hint! Calling XmUpdateDisplay() did not have the desired
> effect, however.
> 
> It turned out that I have to explicitly do an XtDestroyWidget() on the
> old menubar before setting the new one (which I had not yet done). It
> seems like -- if you don't do this -- the MainWindow widget keeps a
> reference of the old menubar somehow still around, even though it should
> have been overwritten by XtVaSetValues(XmNmenuBar).
> 
> Best,
> Holger
>

If you just want to redraw one widget, you can do it like this ("w" is the 
widget), you have to include a private header though, for access to
core_class.expose

#include <X11/IntrinsicP.h>

XExposeEvent xev;
Dimension ww, hh; /* the widget's width and height */

xev.window  = XtWindow(w); 
xev.type    = Expose;
xev.display = XtDisplay(w);

XtVaGetValues(w, XmNwidth, &ww, XmNheight, &hh, NULL);

xev.width  = ww;
xev.height = hh;

(XtClass (w))->core_class.expose(w, (XEvent *) &xev, NULL);
 


More information about the xorg mailing list