[comp.windows.x] Achieving constant thickness scrollbars under resizeable form.

ramakris@bloss.cs.vt.edu (S.Ramakrishnan) (08/15/90)

Trouble in keeping scrollbars from getting resized.
--------------------------------------------------

 I need help in creating a config in which resizing the toplevel
 window will leave the scrollbar children undisturbed
 breadthwise.

Setup is ...
------------

	   canvas_shell  (topLevelShellWidgetClass)
	      |
	      |
           form widget
	    |   |    |
           /    |     \
         box   horiz   vertical
       widget  scroll  scrollbar widget


   * The scrollbars are :

       1) chained to the form boundary (Horiz chained with
       XtNchainBottom and vert scrollbar with XtNchainLeft
       to the form).

       2) are created with Resizeable == False, i.e. not to be
	  resized when form is resized.

   * The vertical scrollbar is separated by the fromVert
     attribute  from the box widget. The vertDistance is 1.

   * The horizontal scrollbar is separated by the fromHoriz
     attribute from the box. The horizDistance is 1.

   * The horiz scrollbar is separated from the vertical
     scrollbar by the fromVert attribute. vertDistance value
     is 1.
      
      Whenever the form is resized, I do the following :
      
	* Inhibit form relayout (XtFormDoLayout(form, False)).
	
	* The box is resized .
	
	* The horiz scrollbar is made to assume the new width  
	  of the box.

        * And the vert scrollbar the new ht of the box. 
	
	* The thicknesses of the scrollbars are forcibly set 
	  to a constant at every resize.

	* Allow form layout (XtFormDoLayout(form, True)).


	* Do a XtResizeWindow(form) after all this.

  Results :
  --------

   Whenever the toplevel window is resized, the three children
   get resized proportionately. The scrollbars become "fat" (how
   I hate fat scrollbars !) when the form is enlarged and they
   become thin as Kellog's Oat Bran Pretzels when the form is
   contracted (how I hate scrollbars as thin as Kellog's Oat
   Bran Pretzels !). 

 Question :
 --------

  * CAN SOMEONE HELP ?
  
  * How else may I achieve the results I desire ?

 (Please email the response to ramakris@bloss.cs.vt.edu instead
  of posting it).


--

 -- S.Ramakrishnan, CS Dept, McBryde Hall, VaTech, Blacksburg, Virg. 24061-0106
   (email : ramakris@bloss.cs.vt.edu, ramakris@vtcc1.cc.vt.edu)

swick@ATHENA.MIT.EDU (Ralph Swick) (08/18/90)

This should be easy to do.  Remember, there are 4 edges to each
child and you can chain each one independently.

	   2) are created with Resizeable == False, i.e. not to be
	      resized when form is resized.

Actually, Form/XtNresizeable says whether or not the child is
allowed to request a geometry change; it has nothing to do
with what happens when the Form itself is resized.

       * The vertical scrollbar is separated by the fromVert
       ...

Did you say these backwards, by any chance?  The mental picture
I draw is a bit peculiar, but maybe it is really what you
intend; no matter...

Chaining both the top and bottom of the horizontal scrollbar
to the form bottom and both the left and right of the vertical
scrollbar to the form left should cause their thicknesses to
remain constant.  I rather suspect your resize algorithm
can be completely specified as resources.