Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 19272, Menu Skinning with ActionBands

by Steve Trefethen Email: Anonymous


This demo illustrates how to use ActionBand menus to "skin" existing TMainMenu components.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 7.0  to 7.0 2798 downloads
Copyright: All rights reserved


Size: 4,739 bytes
Updated on Fri, 18 May 2007 13:43:16 GMT
Originally uploaded on Mon, 18 Nov 2002 10:15:46 GMT
SHA1 Hash: F1E32851B94709A6812F09A7309F714CBA914A54
MD5 Hash: D5F4E02CA281214C0B5E42664B591749

    Explore the files in this upload

Description
This demo illustrates how you can use ActionBand menus to "skin" an existing TMainMenu component all without having to completely switch your application to use ActionBands. The demo includes the code necessary to dynamically build ActionBand menus that mirror your applications existing menus. The advanatage is that you can update the appearance of your application's menus without switching the entire application over to use either Actions or ActionBands. While the ActionBand components are required to render the menus using various styles, you continue to modify your existing TMainMenu during application development to add new functionality or change existing functionality. To skin your applications popup menus you can use the TActionPopupMenu included in the update below.

The code provided in this demo simply gives you a means to leverage the new menu styles included with ActionBands in a way the has the least impact to your code. Typically when a developer starts a new
application is when they would decide to use ActionBands because prior to this demo it was unclear how to use ActionBands without making large scale changes to an existing application.

The Delphi IDE itself uses a similar technique to "skin" it's menus while maintaining full backwards OTA compatibility.

In order to skin your applications TMainMenu components use the following steps:

1. Open your application in the IDE
2. Select your applications main form (the one with your TMainMenu) and clear its Menu property and drop a TActionMainMenu and a TActionManager component onto the form
3. Select the TActionManager and double click the ActionBars property in the Object Inspector
4. Click the Add New button on the collection editor window and set the first item's ActionBar property to the TActionMainMenuBar
5. You will need to copy the following methods from the demo and add them as methods to your form: TForm1.LoadMenu, TForm1.UpdateMainMenuBar
6. On the TActionMainMenuBar assign the OnPopup and the OnExitMenuLoop events and copy the code from the corresponding events of the demo.
7. From the demo copy the FNewMenuActions: TList data member and add it to the private section of your Form
8. Add an OnCreate event to your form and copy the code from the demo's TForm1.FormCreate event to it
9. Add an OnDestroy event to your form and copy the code from the demo's TForm1.FormDestroy event to it

At this point you should be able to run your application and use the new menu styles made possible by ActionBands. For additional control of menu colors try dropping one of the ColorMap components from the additional tab of the Component Palette and assigning it to your TActionMainMenuBar.ColorMap property.

For more information, see http://www.stevetrefethen.com/blog

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC04