[comp.windows.x.motif] Widget placement

kquick@dcs.simpact.com (Kevin Quick, Simpact Assoc., Inc.) (05/24/91)

Hello all.  I'm having some trouble with positioning widgets and having
them automatically shifted when the enclosing widget is resized.  What I
am seeking is the nice management that a selection box uses for its
pushbuttons.  When the selection box is resized, the buttons are shifted
and stacked to proportionally fit the available space.

I have three PushButtons which would like similarly handled at the bottom
of a FormDialog.  At the moment, I am using a form to contain them, but I
haven't been able to place the middle button specifically at the center of
the form; the closest I can come is to make its left attachment to a position
that I initially calculate to be at the correct location for the original
window size; resizing the FormDialog larger works fairly well, but larger
sizes show the button as no longer centered.  Additionally, when the form
shrinks below optimal size, the buttons start to overlap and are not
restacked.

I have tried a RowColumn container widget; it didn't even space out the
buttons when the window was enlarged.  I also tried a BulletinBoard
dialog, but that also failed.

Am I missing some kind of container that would help?  Am I using the
right container, but specifying the attachments incorrectly?  I tried
looking at the SelectionBox source for hints, but it does lots of
internal stuff with the Geo__.c functions which are not available to
standard clients (or are at least undocumented to my knowledge).  Any
help would be appreciated, and more specific info is available on
request.  I would settle for proportional placement on window expansion,
although the stacking is nice when the window is small.

Also, any word on when the Xm library might be available in a shared
library format?  (Current config: Sun SLC, X11R4, Motif 1.1)

Thanks in advance!

--
	-- Kevin Quick,  Simpact Associates, Inc.,  San Diego, CA.
	   UUCP: kquick@simpact.com  (or simpact!kquick@crash.cts.com)

sy18337@fmrco (Terry Traub) (05/24/91)

In article <1991May23.184014.2329@dcs.simpact.com> kquick@dcs.simpact.com (Kevin Quick, Simpact Assoc., Inc.) writes:
[...]
>I have three PushButtons which would like similarly handled at the bottom
>of a FormDialog.  At the moment, I am using a form to contain them, but I
>haven't been able to place the middle button specifically at the center of
>the form; the closest I can come is to make its left attachment to a position
>that I initially calculate to be at the correct location for the original
>window size; resizing the FormDialog larger works fairly well, but larger
>sizes show the button as no longer centered.  Additionally, when the form
>shrinks below optimal size, the buttons start to overlap and are not
>restacked.
[...]
>Thanks in advance!
>
>--
>	-- Kevin Quick,  Simpact Associates, Inc.,  San Diego, CA.
>	   UUCP: kquick@simpact.com  (or simpact!kquick@crash.cts.com)


Kevin,
I've had some success using the following approach:
If you have, say, 5 pushbuttons you want uniformly aligned horizontally,
put them in a form and attach them to the top and bottom.  Then leftAttach the
leftmost button to the form, and rightAttach the rightmost button to the
form.  Then, the key thing is to make the rightAttachments of the first four
buttons to be attachPosition, using some appropriate percentage of the 
distance, and make leftAttachment of the 2nd through 5th buttons attachWidget
to the button to their left.  Then your buttons will all resize correctly.

Terry Traub
Fidelity Investments
Boston, Mass.
ttraub@fmrco.UUCP (uunet!fmrco!lanyard!ttraub)