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:

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 task bar. You can close a tab by clicking the close button in the thumbnail preview in Windows task bar.

Note: Only .bmp images can be opened.

How to Use the Sample

  1. Navigate to Start | Programs | Embarcadero RAD Studio Rio | 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 form where new images are open and the child forms are created.

MDIChild

The child form where customized task bar preview functionality is done.

Classes

  • TForm2, the form class, implements the main visual component of the application. It contains a TMainMenu component and a TActionList to open a image file in a child form.
  • TFrMDIChild, the child form class, contains a TImage and the customized TTaskbar component. It implements the functionality to close the child form.

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 TMainMenu 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 task bar.

Uses

See Also