VCL Controls: The Splitter Bar



A splitter is a bar that divides a window area in two sections. These sections are referred to as panes or frames.. The splitter bar is used to create independent sections holding various controls. The splitter can divide the sections horizontally or vertically, depending on how you create it. Among other things, the design and implementation allows to display related data.

 Creating a Splitter

To create a splitter bar, click the Splitter control from the Additional tab of the Component Palette. The Splitter must be added to a control that has the Align property set to a value other than alNone. If the splitter is embedded to a control that has the alLeft or alRight Align property, it will create two vertical sections. If the Align property of a control is set to alTop or alBottom when receiving the splitter, this creates two horizontal sections. By using a combination of panels and other controls, you can divide the window in as many sections as necessary and in any way.


A Splitter With Two Panes

  1. On the form, add a panel with Align = alLeft
  2. Click an empty area on the form (right side) and add a Splitter bar from the Additional tab (notice that the splitter is left aligned automatically
  3. On the right side of the form, add another panel with Align = alClient.

A Splitter With Three Panes (Like Windows Explorer With Tips)

  1. Create a new form
  2. Add a panel (Panel1) to the form with Align = alTop
  3. Add another panel (Panel2) to the empty area of the form with Align = alLeft
  4. From the Additional tab, click Splitter and click the empty area on the right side of the form
  5. Add another panel (Panel3) to the right side of the splitter with Align = alClient
  6. Add another panel (Panel4) to the previous panel (Panel3) with Align = alBottom
  7. Add a splitter to Panel3 and change its Align to alBottom
  8. Add a last panel (Panel5) to Panel3 with Align = alClient
  9. Test the application


Home Copyright © 2002-2007 FunctionX, Inc.