Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!cs.utexas.edu!uunet!convex!gstiehl@convex.com From: gstiehl@convex.com (Greg Stiehl) Newsgroups: comp.windows.x.motif Subject: Re: Aligning side-by-side RowColumn widgets Keywords: RowColumn Message-ID: <1991Jan10.153947.20059@convex.com> Date: 10 Jan 91 15:39:47 GMT References: <2506@apctrc.UUCP> Sender: news@convex.com (news access account) Reply-To: gstiehl@convex.com (Greg Stiehl) Organization: Convex Computer Corp, Graphics Software Lines: 58 Nntp-Posting-Host: pixel.convex.com > O.K., I admit defeat. I have been trying for much too long to get > fields in two side-by-side rowcolumn widgets inside a form dialog > to line up. What I'm trying to do is this: > > label1 text > label2 text > label3 text > label4 text > label5 toggle > etc.. Welcome to the club. My office mate and I are constantly banging our heads against this wall. Although I don't see any feasible way for two RowColumn widgets to line up elements, it does seem reasonable to use one RowColumn, set XmNnumColumns = 2 (in this case), and XmNpacking = XmPACK_TIGHT. Of course this doesn't work because XmNnumColumns is only meaningful when XmNpacking is set to XmPACK_COLUMN. But XmPACK_COLUMN makes all entries the same size, which is obviously not what you want. Enough bitching, here are a couple work arounds: 1. Use a Form. a. Connect the top of the first widget in each column to the FORM and subsequent widgets to the previous widget in that column. b. Connect the left of each widget in the first column to the FORM. c. Connect the right of each widget in the last column to the FORM. c. Connect the bottom of each widget to POSITION and set the bottomPosition to I, where I is it's position in the column (1 = the first element). Setting XmNfractionBase to the Number of rows. d. How you connect the widgets to each other depends on what you want. The about example would probally want to just attach the text widget to the label widget. This is good in that it allows you to leave all the positioning up to Motif, but all those attachments can get pretty gross. It is fairly easy to add things to the bottom. Just remember the last row of elements, so attach the new widgets to them. And increment the XmNfractionBase. It would be a pain to add things in the middle. 2. Use a RowColumn of RowColumns This approach uses a lot of widgets, but it makes it easy to add things in the middle (as well as the bottom). On the down side, it breaks up the logical grouping of columns of data. 3. Use a bulletinBoard. You basicall have to do all your own placement calculations. Very brute force. easy to add things at the bottom. Not a very good approach, unless you just can't use any of the above approaches. I have C source for the first two ways of doing this. Send me mail if you want them. If anyone has a better way, I would be very interested. ----------- Greg Stiehl (gstiehl@convex.com) Convex Computer Corporation