VCL.OneFormApp Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates the use of the task bar component in a Delphi/C++ application. The application shows how to use the progress bar, change the overlay icon, modify thumb buttons actions and appearance, and clip the thumbnail preview region in the Windows task bar.

Location

You can find the One Form Application sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to either:
    • Object Pascal\VCL\Taskbar\OneForm
    • CPP\VCL\Taskbar\OneFormApp
  • 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 form has functionality to change the progress bar status (state and progress values) and the overlay icon of the application task bar, to modify a message that is shown when a thumb button is clicked and to resize the preview thumbnail in the Windows task bar.

  • On the Progress example panel, switch between the different states for the progress status in the combo box and change the value of the progress bar by dragging the slider to the desired position.
  • On the OverlayIcon panel, change the overlay icon of the application task bar by selecting it.
  • On the Buttons panel, select the visibility of a thumb button and change the message that is shown when clicking the thumb button.
  • On the Clip Region panel, clip the form region that is shown in the thumbnail preview by modifying the values.

How to Use the Sample

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

Files

This project has one source file, SimpleFormApp, which contains the class for the main form.

Classes

  • TForm1, the form class, implements the main visual component of the application. It contains four panels, buttons and functionalities to customize the application task bar.

Implementation

  • The TTaskbar component is used to control the application Windows task bar.
  • Three TThumbBarButton are added to the task bar. Set their visibility and use a custom action for them. Use the ApplyButtonsChanges method to update them at once.
  • The TActionList component defines custom actions for the thumb buttons.
  • The TComboBox component is used to select the state of the progress bar and the TTrackBar component is used to set the progress value. These changes are displayed in the Windows task bar.
  • The TImageList component includes all the icons that can be used in the application task bar (for the thumb button icons and the overlay icon).
  • Use the ApplyClipAreaChanges method to clip the thumbnail preview region of the application in the Windows task bar.

Uses

See Also