Defines the TPairSplitter component.

pairsplitter.pas defines the TPairSplitter component. TPairSplitter is a component with two TPairSplitterSide children. Both child components can contain other components. The children are separated by a splitter which can be dragged by the user to resize the adjacent children.

Author: Mattias Gaertner

The following components are added to the Lazarus IDE component palette:

Additional Tab

  • TPairSplitter

Registered but not displayed:

  • TPairSplitterSide
Implements the child controls used in the TPairSplitter component.

TPairSplitterSide is a TWinControl descendant that represents the child controls used in the TPairSplitter component. TPairSplitterSide behaves like a TPanel component with a reference to the TPairSplitter that owns the control. TPairSplitterSide provides a custom Paint method and WMPaint message handling. TPairSplitterSide alters the visibility of inherited properties to match their intended usage.

TWinControl
Gets the value for the Splitter property. Value for the property. Sets the value for the Parent property.

SetParent is an overridden procedure used to set the value in the Parent property. SetParent is the re-implemented write access specifier for the Parent property.

SetParent ensures that the control is removed from the Sides property in the existing Parent prior to setting the new value for the property. SetParent calls the inherited method to handle the Bounds and AutoSizing for the control.

If the new Parent is not Nil, the private AddSide method in the TPairSplitter instance is called to add the current control.

TControl.Parent TControl.SetParent TControl.CheckNewParent
New value for the Parent property. Provides custom handling for WMPaint messages. WM_PAINT message for the control. Renders the control on its Canvas. Constructor for the class instance.

Create is the constructor for the class instance, and calls the inherited constructor using TheOwner as the owner of the control. Create updates values in the ControlStyle property and the internal window control flags used in the control.

Owner of the control. Destructor for the class instance.

Destroy if the destructor for the class instance, and calls the inherited destructor.

TPairSplitter for the control.

Splitter is a read-only TCustomPairSplitter property which represents the component for the control. The value in Splitter is the same as the Parent for the control, or Nil when Parent has not been assigned.

Sets the orientation for the Splitter in TPairSplitter.

TPairSplitterType is an enumeration type with values that set the orientation for the splitter in the TPairSplitter component. The values refer to the splitter orientation relative to the adjacent children.

TPairSplitterType is the type used for the TCustomPairSplitter.SplitterType property.

Splitter is oriented to size adjacent children horizontally. Splitter is oriented to size adjacent children vertically. Defines the base class for the TPairSplitter component.

Defines the base class for the TPairSplitter component. TPairSplitter is a component with two TPairSplitterSide children. Both child components can contain other components. The children are separated by a splitter which can be dragged by the user to resize the adjacent child controls.

TWinControl
Gets the value for the Cursor property. Value for the Cursor property. Sets the value for the Cursor property. New value for the Cursor property. Gets the default size for the control class.

GetControlClassDefaultSize is a TSize class function used to get the default size for new instances of the class. GetControlClassDefaultSize stores the Width and Height using the CX and CY members in the TSize value. The default value in both CX and CY is 90 pixels.

GetControlClassDefaultSize is called from the Create constructor.

TControl.GetControlClassDefaultSize TSize
TSize type with the default Height and Width for instances of the class. Constructor for the class instance.

Create is the constructor for the class instance. Create calls the inherited constructor using TheOwner as the owner of the component.

Create calls the GetControlClassDefaultSize class method to get the default height and width values used in instances of the class type, and calls SetBounds to apply the values. Create sets the default values for the following properties:

ControlStyle
Removes the value csAcceptsControls in the property
SplitterType
pstHorizontal
Cursor
crHSplit
Position
45

Create calls the CreateSides method when csDesigning is not in the ComponentState property. CreateSides ensures both TPairSplitterSide instances are created (and parented) in the Sides property.

TWinControl.Create
Owner of the component. Destructor for the class instance.

Destroy is the destructor for the class instance. Destroy ensures that the class instances in Sides are not created (or re-created), and calls the inherited destructor.

TWinControl.Destroy
Creates the window handle for the control.

CreateWnd is an overridden procedure used to create the window handle for the control. CreateWnd calls CreateSides to ensure both TPairSplitterSide instances are created (and parented) in the Sides property. CreateWnd calls the inherited CreateWnd method.

TWinControl.CreateWnd
Updates the value in the Position property.

UpdatePosition is a procedure used to update the value in the Position property. UpdatePosition calls the SetPosition method in the WidgetSetClass to recalculate the current relative position for the splitter control. UpdatePosition stores the value in the Position property.

UpdatePosition is called when the value for the Position property is read.

Creates missing any controls in the Sides property.

CreateSides is a procedure used to create missing values in the Sides property. CreateSides ensures that both TPairSplitterSide instances used in the component have been created (and parented).

No actions are performed in the method when component streaming has not been completed, or when the component is freed.

CreateSides is called from the Create, CreateWnd, and Loaded methods.

Performs actions when LCL component streaming has been completed.

Loaded is an overridden procedure which performs actions needed when the component has been loaded using the LCL component streaming mechanism. Loaded calls the inherited Loaded method.

Loaded calls the CreateSides method to ensure that both values in the Sides property have been created. Loaded updates the value in Position if the handle for the control has been allocated.

TWinControl.Loaded
Determines if the class is inherited from a specific ancestor.

ChildClassAllowed is an overridden Boolean function used to determine if the specified class is inherited from a specific ancestor class. ChildClassAllowed calls the ChildClass.InheritsFrom method. The return value is True when it is derived from the TPairSplitterSide or TSplitter classes.

Class to compare in the method` True if the class has a specific ancestor. Cursor displayed when the control is resized.

The default value for the property is crHSplit in TCustomPairSplitter.

TControl.Cursor
Provides access to the adjacent children resized using the Splitter.

Sides is a read-only indexed TPairSplitterSide property which provides access to the adjacent children resized using the Splitter in the component. Sides always has 2 elements in the array (in the range 0..1). If Index contains an invalid value, an exception is raised.

Each control in Sides behaves like a TPanel component with a reference to the TPairSplitter that owns the control. They provide a custom Paint method and WMPaint message handling. Some of their properties have altered visibility; for example, Align and Anchors are private, Top and Left are public.

Calls RaiseGDBException to raise an exception when Index < 0 or Index > 1. Raised with the message 'TCustomPairSplitter.GetSides: Index out of bounds'.

Ordinal position the adjacent child control. Specifies the orientation for the splitter in the component.

SplitterType is a TPairSplitterType property which specifies the orientation for the splitter in the component. The values in TPairSplitterType dictate the splitter orientation relative to the adjacent children in Sides. Setting a new value in the SplitterType property causes the value in the Cursor property to be changed to match the selected orientation. For example:

pstHorizontal
Splitter is oriented to size adjacent children horizontally. Cursor is set to crHSplit. (Default value)
pstVertical
Splitter is oriented to size adjacent children vertically. Cursor is set to crVSplit.
TCursor
Indicates the position for the Splitter relative to its orientation.

Position is an Integer property that indicates the position for the splitter relative to its orientation. Reading the value in splitter causes the UpdatePosition method to be called to recalculate the current position for the Splitter. Position can be set at design-time, or changed at run-time by dragging the grab bar for the splitter. The value in Position affects the sizing of the adjacent child controls in Sides.

When SplitterType contains pstHorizontal, the value in Position is used as the Width for the child control in Sides[0]. The remaining Width in the component (less the 5 pixels used for the Splitter) is set as the Width for the child control in Sides[1].

When SplitterType contains pstVertical, the value in Position is used as the Height for the child control in Sides[0]. The remaining Height in the component (less the 5 pixels used for the Splitter) is set as the Height for the child control in Sides[1].

Implements the TPairSplitter component.

Implements the TPairSplitter component. TPairSplitter is a component with two TPairSplitterSide children. Both child components can contain other components. The children are separated by a splitter which can be dragged by the user to resize the adjacent children.

Registers components for use in the Lazarus IDE.

The following components are added to the Lazarus IDE component palette:

Additional Tab

  • TPairSplitter

Registered but not displayed:

  • TPairSplitterSide