[comp.windows.x.motif] Resizing pushbuttons in a form

kittu@shakti.wpd.sgi.com (Krishna Swaroop Kolluri) (03/10/91)

   I've got a form with a variable number of pushbuttons stacked one on top of
   another in the form. The program dynamically reads a file and makes a
   button for each record in the file. When I resize the form, the pushbuttons 
   are not automatically proportionately resized. (i.e., when enlarged, only the 
   bottom pushbutton is expanded; and when shrunk, pushbuttons on the bottom
   are lost). 

They are not getting proportionately resized because you are probably
using Xm_ATTACH_WIDGET. Use Xm_ATTACH_POSITION instead.

   I guess if you could know the number of buttons in advance you could set up a 
   resource file, but I want the program to set everything up for the user and 
   not be dependent on a resource file. Is this possible? 

Yes, this is possible. What you should do is to first figure out how
many records there are in your file and create all your buttons. Let's
assume that there are `n' such buttons. Arrange them within the form
using the position. For instance, the first buttons is from 0 to
100/n; second from 100/n 2*100/n; and so forth and so on.

   The only thing I can think to do is to have the program hand-craft a resource
   file after it knows how many pushbuttons it will have. But surely this can't
   be the correct way to do it. Also, is there any way to specify the size of
   the form so that the user can just put it on the screen somewhere?

Sure, set the width and the height resources using XtSetValues.

hope that helps!

kittu..
--
-------
Krishna Swaroop Kolluri		9U-530		kittu@sgi.com
Silicon Graphics, Inc.				Off:(415)335-1859
						Fax:(415)969-2314