home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / windows / x / motif / 5954 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  6.9 KB

  1. Path: sparky!uunet!mcsun!uknet!lsl!snail
  2. From: snail@lsl.co.uk
  3. Newsgroups: comp.windows.x.motif
  4. Subject: Re: Help with RowColumn alignment
  5. Message-ID: <1992Sep2.151456.2390@lsl.co.uk>
  6. Date: 2 Sep 92 14:14:55 GMT
  7. References: <5572@ucsbcsl.ucsb.edu> <1992Sep1.102453.13839@rks.se>
  8. Organization: Laser-Scan Ltd., Cambridge
  9. Lines: 139
  10.  
  11. In article <1992Sep1.102453.13839@rks.se>, vaxtosv@rks.se writes:
  12. > In article <5572@ucsbcsl.ucsb.edu>, 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack) writes:
  13. >> I'm trying to create an input section of a program that that has
  14. >> a Label and a Text widget side-by-side.  Since there are many inputs,
  15. >> I decided to use a RowColumn container for alignment.  This turned
  16. >> out to be unacceptable since the Text widgets were created as large
  17. >> as the largest Label in the first column:
  18. >> 
  19. >>     -----------------------------------------------------------
  20. >>     |  -------------------------   -------------------------  |
  21. >>     |  |                       |   |                       |  |
  22. >>     |  |       Label 1         |   |        Text 1         |  |
  23. >>     |  |                       |   |                       |  |
  24. >>     |  -------------------------   -------------------------  |
  25. >>     |                                                         |
  26. >>     |  -------------------------   -------------------------  |
  27. >>     |  |                       |   |                       |  |
  28. >>     |  |       Label 2         |   |        Text 2         |  |
  29. >>     |  |                       |   |                       |  |
  30. >>     |  -------------------------   -------------------------  |
  31. >>     |                                                         |
  32. >>     |  -------------------------   -------------------------  |
  33. >>     |  |                       |   |                       |  |
  34. >>     |  |       Label 3         |   |        Text 3         |  |
  35. >>     |  |                       |   |                       |  |
  36. >>     |  -------------------------   -------------------------  |
  37. >>     -----------------------------------------------------------
  38. >> 
  39. >> So instead of using a single RowColumn, I used two and have run into
  40. >> a different problem which has become rather annoying.  Now the Text
  41. >> widgets are of the correct width, but the Labels no longer line up
  42. >> with the Text widget that they refer to:
  43. >> 
  44. >>   -----------------------------------------------------------
  45. >>   | ------------------------------- ----------------------- |
  46. >>   | |  -------------------------  | |  -----------------  | |
  47. >>   | |  |       Label 1         |  | |  |               |  | |
  48. >>   | |  -------------------------  | |  |    Text 1     |  | |
  49. >>   | |  -------------------------  | |  |               |  | |
  50. >>   | |  |       Label 2         |  | |  -----------------  | |
  51. >>   | |  -------------------------  | |                     | |
  52. >>   | |  -------------------------  | |  -----------------  | |
  53. >>   | |  |       Label 3         |  | |  |               |  | |
  54. >>   | |  -------------------------  | |  |    Text 2     |  | |
  55. >>   | |                             | |  |               |  | |
  56. >>   | |                             | |  -----------------  | |
  57. >>   | |                             | |                     | |
  58. >>   | |                             | |  -----------------  | |
  59. >>   | |                             | |  |               |  | |
  60. >>   | |                             | |  |    Text 3     |  | |
  61. >>   | |                             | |  |               |  | |
  62. >>   | |                             | |  -----------------  | |
  63. >>   | ------------------------------- ----------------------- |
  64. >>   -----------------------------------------------------------
  65. >> 
  66. >> Both RowColumn widgets are children of a Form with attachments set to
  67. >> XmATTACH_FORM on all sides (except the inner attachment where RowCol2
  68. >> is attached to RowCol1).  I tried setting up RowCol1 as XmHORIZONTAL
  69. >> with 3 columns, but the result was that Label3 expanded to fill all of
  70. >> the space below Label2 which was left unchanged.  I expected this to
  71. >> work since XmNpacking is set to XmPACK_COLUMN which says it puts all
  72. >> the children into identically sized boxes.
  73. >> 
  74. >> Does anybody know how to fix this?
  75. >> 
  76. >> 
  77. >> Mike Mack
  78. >> 6500mack@ucsbuxa.ucsb.edu
  79. >> 
  80. > Your problem lies in the fact that the height of your Label's windows
  81. > are much smaller that your TextField's windows.
  82. > There are quite many resources that makes up the size of primitive widget
  83. > windows, if you are using the same font in both your labels and text widgets 
  84. > you should be able to align labels and texts in two diffrent RowColumns
  85. > providing you modify some of their resources.
  86. > I'll supply you with a list of the resources that makes up the total height
  87. > of windows for Labels, PushButtons and TextFields, and include the default
  88. > values.
  89. > Resource             Label       Pb     Text
  90. > -------------------  -----    -----    -----
  91. > borderWidth:             0        0        0      (* 2)  (Added outside window)
  92. > marginBottom:            0        0      N.A.     (* 1)
  93. > marginTop:               0        0      N.A.     (* 1)
  94. > marginHeigh:             2        2        5      (* 2)
  95. > shadowThickness:         0        2        2      (* 2)
  96. > highlightThickness:      0        2        2      (* 2)
  97. > Total height             
  98. > exluding font height:    4       12       18
  99. > As you can see a Text widget's window is quite much higher. 
  100. > I would suggest you set XmNmarginHeight on your labels to 9 which will
  101. > make them equal.
  102.  
  103. No, No, No. 
  104. Do it like this. I've done it many time sand it's a doddle.
  105.  
  106. One vertical XmRowColumn.
  107. All it's children are XmForms.
  108. The XmForms hold an XmLabel and an XmText (and whatever else you want).
  109. Once everything is managed, you can determine the widest XmLabel and widest
  110. XmText and widest (whatever). Add them all up and set the XmNfractionBase of
  111. every XmForm (which is a child of teh XmRowColumn) to this value. Then just
  112. set all the attachments of the XmForm children to XmATTACH_POSITION and the
  113. XmN(left/right)Position to the appropriate value determined from the
  114. widest values of each appropriate resource. ie:-
  115. For all children of each XmForm set the top and bottom attachments to 
  116. XmATTACH_FORM.
  117.  
  118. For the Label:
  119.  
  120. XmNleftPosition = 0;
  121. XmNrightPosition = widest XmLabel width;
  122.  
  123. For the Text
  124.  
  125. XmNleftPosition = widest XmLabel width;
  126. XmNrightPosition = widest XmLabel width + widest XmText width;
  127.  
  128. For the whatever
  129.  
  130. XmNleftPosition = widest XmLabel width + widest XmText width;
  131. XmNrightPosition = you get the picture....
  132.  
  133. BUT OSF, IT WOULD BE NICE TO HAVE A ROWCOLUMN WHICH DOES DO GENUINE ROWS AND
  134. COLUMNS WITHOUT ME HAVING TO FART ABOUT LIKE ABOVE.
  135.  
  136. No I haven't used the Xbae matrix widget. Maybe I should.
  137.  
  138. snail@lsl.co.uk      
  139.  
  140. Interviewer: "What's the most satisfying thing about being in
  141.               The Sisters Of Mercy?"
  142. Eldritch:    "When I collapse at the end of it..."
  143. Interviewer: "Do you mean that?"
  144. Eldritch:    "Yeah...."
  145.  
  146. Vote for Bill Clinton. Vote for Bill Clinton. Vote for Bill Clinton.
  147.