[All]
Revamp Your Main Menu with Delphi 7
By: Justin Swett
Abstract: How to give a new look and feel to your Delphi 7 applications using the ActionManager.
By
Justin Swett
Borland Developer Support
Delphi 7 introduces the ability to add Windows XP styling to your ActionToolBar
and ActionMainMenuBar through the ActionManager. This document will demonstrate
how to use ActionMainMenuBar to create a XP styled menu with sub menu's.
Enable XP Style
The first step is to create a New Application (File | New | Application )and
drop an ActionManager on the Form. Next you should set the Style property of the ActionManager
to XP Style.
Creating Menu's and Sub Menu's
With the ActionManager on the Form we can now drop a ActionMainMenuBar and
begin making our menu system. ActionMainMenuBar is located on the Additional tab of the component palette. The ActionManager comes with Standard Actions, which are useful for many applications,
however, the Standard Actions are not fine tuned enough for the needs of every application. In order to
make a customized menu system you will need to create a new Category. The Standard Actions serve as an
example since they are grouped by category, such as actions listed in the category of File, or Edit.
Lets create a menu for the File category and then add a sub menu called Some Category. Double click
on the ActionManager component to bring up the default editor. Next Select New Standard Action,
and choose the File category and all of its Actions, then click "OK".
Now we can drag and drop the File category from the ActionManager's Editor to our ActionMainMenuBar, and Delphi
will automatically create a menu for us.
Next lets create a sub menu. First we will want to create a new Category, which can be done by adding a
new Action in the ActionManager editor. In the ActionManager editor create a New Action and give it
a caption, a name, and some event code. Next you can select the category that the
action will belong to, if the Category doesn't exist then you can manually type in the Category and it
will be automatically created:
Go ahead an repeat the process to create some more Actions for this Category. Once the Category is complete
you can drag and drop it from the ActionManager to the ActionMainMenuBar. To make a sub menu you can continue
the drag process over the existing File menu, which will expand the File menu, and then drop
it somewhere within its contents. The end result is show below, however the resulting colors can be
changed by using a XPColorMap and setting the ColorMap of the ActionMainMenuBar.
|