From: vaxtosv@rks.se
Newsgroups: comp.windows.x.motif
Subject: Re: Help with RowColumn alignment
Date: 1 Sep 92 10:24:53 GMT
Organization: RKS Data AB, Vaxjoe, Sweden

In article <5572@ucsbcsl.ucsb.edu>, 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack) writes:
> I'm trying to create an input section of a program that that has
> a Label and a Text widget side-by-side.  Since there are many inputs,
> I decided to use a RowColumn container for alignment.  This turned
> out to be unacceptable since the Text widgets were created as large
> as the largest Label in the first column:
> 
>     -----------------------------------------------------------
>     |  -------------------------   -------------------------  |
>     |  |                       |   |                       |  |
>     |  |       Label 1         |   |        Text 1         |  |
>     |  |                       |   |                       |  |
>     |  -------------------------   -------------------------  |
>     |                                                         |
>     |  -------------------------   -------------------------  |
>     |  |                       |   |                       |  |
>     |  |       Label 2         |   |        Text 2         |  |
>     |  |                       |   |                       |  |
>     |  -------------------------   -------------------------  |
>     |                                                         |
>     |  -------------------------   -------------------------  |
>     |  |                       |   |                       |  |
>     |  |       Label 3         |   |        Text 3         |  |
>     |  |                       |   |                       |  |
>     |  -------------------------   -------------------------  |
>     -----------------------------------------------------------
> 
> So instead of using a single RowColumn, I used two and have run into
> a different problem which has become rather annoying.  Now the Text
> widgets are of the correct width, but the Labels no longer line up
> with the Text widget that they refer to:
> 
>   -----------------------------------------------------------
>   | ------------------------------- ----------------------- |
>   | |  -------------------------  | |  -----------------  | |
>   | |  |       Label 1         |  | |  |               |  | |
>   | |  -------------------------  | |  |    Text 1     |  | |
>   | |  -------------------------  | |  |               |  | |
>   | |  |       Label 2         |  | |  -----------------  | |
>   | |  -------------------------  | |                     | |
>   | |  -------------------------  | |  -----------------  | |
>   | |  |       Label 3         |  | |  |               |  | |
>   | |  -------------------------  | |  |    Text 2     |  | |
>   | |                             | |  |               |  | |
>   | |                             | |  -----------------  | |
>   | |                             | |                     | |
>   | |                             | |  -----------------  | |
>   | |                             | |  |               |  | |
>   | |                             | |  |    Text 3     |  | |
>   | |                             | |  |               |  | |
>   | |                             | |  -----------------  | |
>   | ------------------------------- ----------------------- |
>   -----------------------------------------------------------
> 
> Both RowColumn widgets are children of a Form with attachments set to
> XmATTACH_FORM on all sides (except the inner attachment where RowCol2
> is attached to RowCol1).  I tried setting up RowCol1 as XmHORIZONTAL
> with 3 columns, but the result was that Label3 expanded to fill all of
> the space below Label2 which was left unchanged.  I expected this to
> work since XmNpacking is set to XmPACK_COLUMN which says it puts all
> the children into identically sized boxes.
> 
> Does anybody know how to fix this?
> 
> 
> Mike Mack
> 6500mack@ucsbuxa.ucsb.edu
> 
Your problem lies in the fact that the height of your Label's windows
are much smaller that your TextField's windows.
There are quite many resources that makes up the size of primitive widget
windows, if you are using the same font in both your labels and text widgets 
you should be able to align labels and texts in two diffrent RowColumns
providing you modify some of their resources.
I'll supply you with a list of the resources that makes up the total height
of windows for Labels, PushButtons and TextFields, and include the default
values.

Resource             Label       Pb     Text
-------------------  -----    -----    -----
borderWidth:             0        0        0  	(* 2)  (Added outside window)
marginBottom:            0        0      N.A. 	(* 1)
marginTop:               0        0      N.A. 	(* 1)
marginHeigh:             2        2        5  	(* 2)
shadowThickness:         0        2        2  	(* 2)
highlightThickness:      0        2        2  	(* 2)

Total height             
exluding font height:    4       12       18

As you can see a Text widget's window is quite much higher. 
I would suggest you set XmNmarginHeight on your labels to 9 which will
make them equal.

						Tom
-- 
      +-------------------------+   +-------------------------+
      |  Tom Svaleklev           \ /  E-mail: vaxtosv@rks.se  |
      |  RKS Data AB, Box 209     X   Phone : +46 470 47062   |
      |  S-351 05 Vaxjo, Sweden  / \  Fax   : +46 470 48976   |
      +-------------------------+   +-------------------------+
Newsgroups: comp.windows.x.motif