[comp.windows.x.motif] need help with XmForm widget

bobh@eldar.WR.TEK.COM (Bob Heath (bobh@amadeus.LA.TEK.COM)) (12/15/90)

I have an application which uses a Form widget nested inside of a RowColumn 
widget. I fill the Form widget with a mixture of OptionMenus, Labels and more 
RowColumn widgets arranged in two columns roughly as follows:

		Form
	|--------------------|
	| |-----| |--------| |
	| | O.M.| | RowCol | |
	| |-----| |--------| |
	|                    |
	|  |----| |--------| |
	|  |O.M.| | RowCol | |
	|  |----| |--------| |
	|                    |
	|         |--------| |
	|   Label | RowCol | |
	|         |--------| |
	|                    |
	|         |--------| |
	|   Label | RowCol | |
	|         |--------| |
	|                    |
	|         |--------| |
	|   Label | RowCol | |
	|         |--------| |
	|                    |
	|         |--------| |
	|   Label | RowCol | |
	|         |--------| |
	|                    |
	|         |--------| |
	|   Label | RowCol | |
	|         |--------| |
	|                    |
	|         |--------| |
	|   Label | RowCol | |
	|         |--------| |
	|--------------------|

I know this looks like a candidate for a RowColumn widget rather than a form
but I couldn't find a way to make the left column be right justified and the
right column be left justified within a RowColumn. I considered using two
RowColumn widgets side by side, but then I'd have trouble keeping the rows
alligned. 

In any case, I resorted to using a Form widget and achieved the result I was
after, except for one problem. All but the first row is dynamic. That is,
they come and go during the runtime of the application. When I used a RowColumn
widget, I would just unmanage the ones I didn't need and the RowColumn widget
would shrink to fit just the remainder. The Form widget, on the other hand,
grows as I add rows of widgets, but it doesn't shrink when I unmanage them.
I even tried unmapping and unrealizing them, but the Form stays at whatever
maximum size it was. By the way, I always add/delete rows at the bottom, never
in the middle.

I don't want to delete the extra widgets because I may need them again and
I can't afford the overhead of constantly adding and deleting, let alone the
memory leakage.

Can anybody tell me how to make the Form widget shink back down?

I'm running Motif 1.0 on a Sparc-station 1 with the NeWS server.

						Thanks
							Bob

nazgul@alphalpha.com (Kee Hinckley) (12/17/90)

> I know this looks like a candidate for a RowColumn widget rather than a form
> but I couldn't find a way to make the left column be right justified and the
> right column be left justified within a RowColumn. I considered using two
> RowColumn widgets side by side, but then I'd have trouble keeping the rows
> alligned. 
I'm suprised you got that to work in a Form.  Unless all of the subsequent
left-hand labels are <= the width of the first they usually get truncated,
although it works fine at 1.1.  I believe the 1.1 version will also do the
shrinking you need.

					-kee

tbray@watsol.waterloo.edu (Tim Bray) (12/18/90)

bobh@eldar.WR.TEK.COM (Bob Heath (bobh@amadeus.LA.TEK.COM)) writes:
|I have an application which uses a Form widget...
|...  The Form widget, on the other hand,
|grows as I add rows of widgets, but it doesn't shrink when I unmanage them.
|...
|I'm running Motif 1.0 on a Sparc-station 1 with the NeWS server.

(replying by mail as this is likely of general interest)

Probably the best thing you could do would be to get Motif 1.1.  I was totally
unable to get form widgets to do what I wanted under 1.0, and resorted to
horribly kludgy rowcolumn with ad hoc resizing.  In 1.1, the Form code seems
to be *greatly* cleaned up, and acts more or less determistically.

Not guaranteeing it'll solve your problem, just advising you to stay away from
the 1.0 form widget.  You might also want to take a look at the table widget,
recently posted in one of these groups.

Tim Bray (tbray@watsol.waterloo.edu)