[comp.windows.x.motif] form dialog resizes itself when I change a button label.

wws@rruxc.uucp (Still Searching) (06/20/91)

I have a Form Dialog which contains a scrolled window and four Push-Buttons
on the bottom.  All widgets are attached with ATTACH_POSITION for all four
sides.

Everything is in a C++ Class, and each button has a callBack.  For one button,
I need to toggle the type of data I display and toggle the XmNlabelString to
show the other state that another click will toggle to.  Sounds simple, right?

Well, I'm able to change the label - with XmStringCreate and XtSetArg &
XtSetValues - but the window height & width shrinks with every button click!
I am totally baffled.  It makes no difference whether the window is empty or
contains data.  The darn thing keeps shrinking with every click until the
whole thing is too small to focus on the buttons.  Could this have anything to
do with the fact that I'm changing a resource for the widget that's being
passed to the callBack?

Any hints or suggestions?

Thank you,
Wayne Scott
----------------------------------------------
	wws@bcr.cc.bellcore.com
I'm just a soul whose intentions are good,
Oh Lord, please don't let me be misunderstood.

wws@rruxc.uucp (Still Searching) (06/20/91)

> Well, I'm able to change the label - with XmStringCreate and XtSetArg &
> XtSetValues - but the window height & width shrinks with every button click!

The labelStrings I'm toggling between are not of the same length; they are
called "Long" and "Short."  I believe that's what was causing the size
recalculation.  Setting XmNrecomputeSize to FALSE gives me what I want.
However, if the strings differed by many more characters, this might not be
adequate because of clipping.

Wayne
----------------------------------------------
	wws@bcr.cc.bellcore.com
I'm just a soul whose intentions are good,
Oh Lord, please don't let me be misunderstood.

beau1029@mstr.hgc.edu (donald beaudry) (06/26/91)

Here the possible solution:  the label widget and gadget classes contain 
an XmNrecomputeSize resource.  Set this resize to false.

If you still don't get the desired result, set the button's labelString to
the longest possible value when you create it, and then do a SetValues to
set the recomputeSize resource to false.