Using the Stack Panel Component

From RAD Studio
Jump to: navigation, search

Go Up to VCL


TStackPanel allows you to order a group of controls inside a container in a single column or row, applying homogeneous alignment, margin, and padding settings to the controls inside the panel. The Orientation property determines the flow of the internal controls, which can be horizontal or vertical.

TStackPanel fully supports VCL styling for Windows 10 and previous versions of Windows.

TStackPanel.png

StackPanel Properties

TStackPanel allows you to configure the following main properties:

  • The HorizontalPositioning property allows you to set the horizontal position of the controls when you select the vertical orientation. Choose from Center, Fill, Left, or Right.
  • The Margins property allows you to establish the values for Bottom, Left, Top, and Right margins.
  • The Orientation property allows you to choose a Horizontal or Vertical orientation for the controls.
  • The Padding property allows you to set the values for Bottom, Left, Right, and Top padding.
  • The VerticalPositioning property allows you to set the vertical position of the controls when you select the horizontal orientation. You can choose from Bottom, Center, Fill, or Top.

TStackPanel properties.png

StackPanel Items Properties

Each control hosted by a StackPanel has additional properties (listed at the bottom of the Object Inspector):

  • The ControlIndex property allows you to change the sequence of the controls in the container.
  • The HorizontalPositioning property allows you to modify the horizontal position of the individual control when you select the vertical orientation. The sphpDefault value assigns the host panel HorizontalPositioning value to the control.
  • The VerticalPositioning property allows you to modify the vertical position of the individual control when you select the horizontal orientation. The sphpDefault value assigns the host panel VerticalPositioning value to the control.

TStackPanelItems Properties.png

Changing Styles

TStackPanel allows you to set custom styles. You can choose from a variety of VCL Styles and apply a selected style in a few steps:

  1. Click Options in the Project menu to open the Project Options dialog box.
  2. Click Application in the left-hand panel and select Appeareance.
  3. Select a style from the list of Custom Styles and click OK.

TStackPanel styles.png

See Also