VCL.MDIApp Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows the use of the customized tab preview in the Windows task bar for a Delphi/C++ application.

Location

You can find the MDIApp sample project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and then navigate to either:
    • Object Pascal\VCL\Taskbar\MDI
    • CPP\VCL\Taskbar\MDIApp
  • 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

The application creates a main form that has the functionality to open images in a new child form. The application shows a thumbnail preview of each new image in the Windows taskbar. You can close a tab by clicking the close button in the thumbnail preview in Windows taskbar.

How to Use the Sample

  1. Navigate to Start | Programs | Embarcadero RAD Studio Alexandria | Samples and open:
    • Delphi: MDIApp.dproj
    • C++: CPPMDIApp.cbproj
  2. Press F9 or choose Run > Run.

Files

This project has two source files:

File Contains

MainMDIForm

The main MDI form where text files are open and the child forms are created.

MDIChild

The child form with text editor.

Classes

  • TMainForm, the main MDI form class, implements the main visual component of the application. It contains a TActionMainMenuBar component and a TActionList to open a text file in a child form.
  • TMDIChild, the child form class, contains a TMemo to edit a text.

Implementation

  • For the main form, in the Object Inspector set the FormStyle property to fsMDIForm. For the child form, in the Object Inspector set the FormStyle property to fsMDIChild.
  • The menu item in the TActionMainMenuBar of the application is linked to the open file action in the TActionList, and a new child form is created for each opened image file.
  • The TTaskbar component registers each new form as a new tab.
  • For the TTaskbar component, in the Object Inspector set the CustomizedPreview property of the TabProperties to True. A preview thumbnail of each image is shown in the application Windows taskbar.

Uses

See Also