The ActionManager Component

Hierarchy: TObject -
TPersistent - TComponent
-
TCustomActionList - TCustomActionManager - TActionManager
This component is used, in conjunction with the ActionToolbar and ImageList, to produce toolbars and menus.
Properties
ActionBars
This gives access to the ActionBars editor from which you can select
ActionBars you have added and change their properties. From this you access the
Background property (change the background image), the BackgroundLayout
property, the Color property (change the colour of the toolbar), the GlyphLayout
property (left, right, etc.) and the Items property (which items are present on
the toolbar).
Images
Use this property to provide a list of images to associate with actions in a
toolbar. You will have to add an ImageList
first (Win32 palette). When you have added an ImageList you can pick up the
standard images that go with standard actions automatically, Delphi adds the
image to the list and sets the ImageIndex property. For non-standard actions you
will have to add images yourself and choose their ImageIndex manually.
Example
To create a toolbar on a form with standard actions proceed as follows:
- Drop an ActionManager component on a form;
- To add images to items in the ActionToolbar add an
ImageList (Win32
palette) and set the Images property of the ActionManager to the ImageList
you just added (you can also add icons from a source such as C:\Program
Files\Common Files\Borland Shared). Now when you add a Standard Action you
will also pick up the standard icon.
- Double click the ActionManager icon to open the ActionManager editor:

- Under Toolbars click the New button to
add an ActionToolbar;
- Under Actions click the New Action drop down list button next to (the
yellow folder with star) and choose 'New Standard Action'. This opens a tree
list from which you can choose existing actions such as Copy, Cut and Paste;

- Select items from the list of actions and double click them (or click OK)
to add them to the ActionList.
- Select each Action in right hand panel and change its ImageIndex
property to match the one required (this depends on what you have added to
the ImageList).
- Drag items from the right side the Actions panel onto the toolbar on the form.
- Once the Actions are in the list they can be selected and their
properties can be changed, for example the ImageIndex can be changed to
match the appropriate icon in the ImageList.
Here is a simple example showing how a memo can be used as a simple text
editor:

When you run the application you can use the options on the toolbar to carry
out standard operations such as copy, cut, paste, select and undo.

Back to Tutorial
Back to Palette List