Previous Topic

Next Topic

Inhoudsopgave

Book Index

TSplitter Control

TSplitter

Description

Divides the client area of a form into resizable panes.

Remarks

Add a splitter to a form between two aligned controls to allow users to resize the controls at runtime. The splitter sits between a control aligned to one edge of the form and the controls that fill up the rest of the client area. Give the splitter the same alignment as the control that is anchored to the edge of the form. When the user moves the splitter, it resizes the anchored control. This, in turn, changes the client area of the form, and the controls that fill up the rest of the client area resize accordingly.

Use each control on the form as a separate pane. After each pane is placed, place a splitter with the same alignment to allow that pane to be resized. The last pane to be placed on the form should be client-aligned, so that it resizes automatically to fill up the remaining space after all other panes are resized.

TSplitter Properties

Property Property AutoSnap: Boolean (R/W)

Determines whether neighboring objects are resized to zero when the splitter is used to make them smaller than MinSize. Set AutoSnap to false to prevent the splitter from resizing neighboring objects to zero when the user tries to make them smaller than MinSize. When AutoSnap is false, such resize attempts are simply blocked, leaving the neighboring object with a size of MinSize. The default value of AutoSnap is true.

Property Property Beveled: Boolean (R/W)

Determines whether the splitter looks beveled along the edge that moves. Set Beveled to false to remove the beveled edges from the splitter. Set Beveled to true to give the edge a 3D beveled look. The bevel on a splitter runs in a single direction only: along the edges the user moves to resize neighboring objects. Thus, if the Align property is alLeft or alRight, the vertical edges of the splitter are beveled. If the Align property is alTop or alBottom, the horizontal edges of the splitter are beveled. The default value of Beveled is false.

Property Property MinSize: Integer (R/W)

Specifies the minimum size, in pixels, of the panes on either side of the splitter. Set MinSize to provide a minimum size the splitter must leave when resizing its neighboring control. For example, if the Align property is alLeft or alRight, the splitter cannot resize the regions to its left or right any smaller than MinSize pixels. If the Align property is alTop or alBottom, the splitter cannot resize the regions above or below it any smaller than MinSize pixels. The default value of MinSize is 30.

Note: Always set MinSize to a value less than half the client width of its parent. When MinSize is half the client width of the splitter's parent, the splitter cannot move because to do so would be to resize one of the panes less than MinSize pixels.

Property Property ResizeStyle: Enumeration (rsNone, rsLine, rsUpdate, rsPattern) (R/W)

Specifies the effect of moving the splitter. Use ResizeStyle to determine what happens when the user moves the splitter with the mouse.