Splitter
[Table of Contents] [Previous: Tabs] [Next: Progress Meter]

Feature Owner: Eric Vaughan

Change History:

  • 9/7/99 - created
The splitter widget is a widget that allows a user to add or remove space between 2 or more children within a box or a box ancestor.(Box ancestors: toolbar, toolbox, tabcontrol, tabbox,  tabpanel, scrollbar)

(Splitters are heavily dependent on the behavior of boxes. If you have not read the box documentation, it is strongly recomended. Box system.)

Here are some examples:

This first example shows how a splitter can be used to change the width of titledbuttons. Notice that the splitter does not squeeze the titled buttons smaller that their min size.
 
<box align="horizontal" flex="1">
   <box flex="1" style="border: 2px inset gray"/>
   <splitter/>
   <box flex="1" style="border: 2px inset gray"/>
</box>

Example1

This example is the same at the first except it show splitters resizing the height of titled buttons.
<box align="vertical" flex="1">
    <box flex="1" style="border: 2px inset gray"/>
    <splitter/>
    <box flex="1" style="border: 2px inset gray"/>
</box>

Example2

Splitters are not limited to one per box. You and put as many as you wish. 
<box align="horizontal" flex="1">
    <box flex="1" style="border: 2px inset gray"/>
    <splitter/>
    <box flex="1" style="border: 2px inset gray"/>
    <splitter/>
    <box flex="1" style="border: 2px inset gray"/>
</box>

Example3

Splitters can also contain custom content. 
 <box align="vertical" flex="1">
    <box flex="1" style="border: 2px inset gray"/>
    <splitter>
      <titledbutton value="button1"/>
      <titledbutton value="button2"/>
      <spring flex="1"/>
      <titledbutton value="help"/>
    </splitter>
    <box flex="1" style="border: 2px inset gray"/>
 </box>

Example4

Splitters respond to several attributes
collapse: *none, before, after

Splitters can have a collapser if requested. This is a small widget that when clicked causes the splitter to collapse the child before or after it. Example.

resizeafter: *closest, farest, grow

This attribute only applies when there are more than one splitter in a box. When the splitter is dragged to the right or down, and resizeafter=closest the child in the box just to the right of the splitter will be resized. If the resizeafter=farest the very last child in the box will be resized. If the resizeafter=grow then the entire box will get larger. Example

resizebefore: *closest, farest

This works exactly the same as resizeafter except in the other direction. If the value is closest and the splitter is resized then the child immediately to the left (or top) will resize. If the value is farest then the very first child in the box will get resized. Example

*=default if no value is specified.
 

More examples:

simple nesting
complex nesting
min max test
flexibility 1 2
resize before and resize after examples: 1 2 3 4 5
sidebar mockup



[Table of Contents] [Previous: Tabs] [Next: Progress Meter]

Contact us at xptoolkitstaff@netscape.com. Want to complain about the new documentation? Email Dave Hyatt.