VCL.SplitView Sample

From RAD Studio Code Examples
Jump to: navigation, search

This is a sample that shows the use of the TSplitView control.

Location

You can find the SplitView sample project at:

  • Start | Programs | Embarcadero RAD Studio Athens | Samples and then navigate to either:
    • Object Pascal\VCL\SplitView
    • CPP\VCL\SplitView
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

This application demonstrates the TSplitView control and shows how to modify its various properties.

The application uses the following controls:

  • ActionList1: The actions associated with the menu items.
  • SV: The split view.
    • catMenuItems: The menu items.
  • pnlToolbar: The panel that holds the title and the master button.
    • imgMenu: The image that acts as the master button.
  • pnlSettings: The panel that holds main application controls.
    • cbxVclStyles: A combo box that allows you to change the style of the application. You can choose any style that is active in the Application Appearance - Custom Styles options for this project.
    • chkCloseOnMenuClick: The checkbox that specifies whether a click on a menu item collapses the split view
    • grpAnimation:
    • grpCloseStyle: Allows you to choose the close style of the split view.
    • grpDisplayMode: Allows you to choose the display mode of the split view.
    • grpPlacement: Allows you to choose the placement of the split view.
    • lstLog: Displays the feedback text.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: SplitView.dproj.
    • C++: SplitView.cbproj.
  2. Press F9 or choose Run > Run.
  3. Change the different options on the form and test the functionality of the split view. Modify display mode, close style, animation speed and step of the split view.

Implementation

TSplitViewForm

On initialization, the FormCreate adds all the active styles to the cbxVclStyles combo box.

The application defines the following event handlers:

  • grpDisplayModeClick: Changes the DisplayMode of the split view.
  • grpPlacementClick: Changes the Placement of the split view.
  • grpCloseStyleClick: Changes the CloseStyle of the split view.
  • SVClosed: The event handler for the OnClosed event. Adjusts the width of the menu items.
  • SVClosing: The event handler for the OnClosing event.
  • SVOpened: The event handler for the OnOpened event. Adjusts the width of the menu items.
  • SVOpening: The event handler for the OnOpening event. Adjusts the width of the menu items.
  • catMenuItemsCategoryCollapase: Prevents the catMenuItems category group from being collapsed.
  • imgMenuClick: Acts as a master button to Open or Close the split view.
  • chkUseAnimationClick: Toggles the UseAnimation property of the split view.
  • trkAnimationDelayChange: Changes the animation delay of the split view.
  • trkAnimationStepChange: Changes the animation step of the split view.
  • actHomeExecute: The event handler for the execution of the corresponding action of this menu item. Logs the name of the menu item into the lstLog and closes the split view if chkCloseOnMenuClick is checked.
  • actLayoutExecute: The event handler for the execution of the corresponding action of this menu item. Logs the name of the menu item into the lstLog and closes the split view if chkCloseOnMenuClick is checked.
  • actPowerExecute: The event handler for the execution of the corresponding action of this menu item. Logs the name of the menu item into the lstLog and closes the split view if chkCloseOnMenuClick is checked.
  • cbxVclStylesChange: Sets the style for the application.

Uses

See Also