VCL.ActionServices Sample

From RAD Studio Code Examples
Jump to: navigation, search

Language:

This sample shows how to extend the Delphi IDE with the IOTAActionServices interface of ToolsAPI. IOTAActionServices performs basic file operations.

Contents

Location

You can find the ActionServices sample project at:

Description

This application creates and installs a wizard that perform these basic operations:

  • open a project
  • open, close, save, and reload a file


The wizard creates a form that displays all the open files in a list box and allows the user to perform operations on files by clicking the buttons in the tool bar located to the right. All the operations are performed within the IDE.

How to Use the Sample

  1. Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open ActionSv.dproj.
  2. Build ActionSv.bpl.
  3. Install ActionSv.bpl.
  4. Select Help > Test Action Services to run the wizard.

Files

File Contains

FrmMain

Implementation for the form shown when the wizard is executed.

WizMain

The wizard class.

Classes

  • TForm2 represents the form that is displayed when the wizard executes.
  • TActionServices represents the wizard class.

Implementation

  • WizMain unit contains an initialization and finalization section. The initialization is responsible for adding the wizard to the BorlandIDEServices variable and the finalization is responsible for removing it.
  • To perform the desired file actions, IOTAActionServices functions are used: OpenFile, OpenProject, ReloadFile, SaveFile, CloseFile. The BorlandIDEServices variable is first cast to IOTAActionServices and then the necessary function is called. For example, to save the file that is selected in the list box the next code is used:
(BorlandIDEServices as IOTAActionServices).SaveFile(ListBox1.Items[ListBox1.ItemIndex]);
  • TActionServices is derived from IOTAWizard and IOTAMenuWizard, therefore it needs to implement all the functions of its ancestors: GetIDString, GetName, GetState and Execute from IOTAWizard and GetMenuText from IOTAMenuWizard.
  • Being a menu wizard, the action services wizard is automatically added to the Help menu.

Uses

See Also

Personal tools