Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2010 Action Manager & Main Menu Bar

I'm trying to use the Action Manager and Action Main Menu Bar in Delphi 2010 an I have no idea how to make this work. I've tried looking at the examples that come with Delphi 2010 and I can't seem to figure this out.

I've tried playing around with the examples. I've been able to add an image to the Image List component and set that item to the new item index. At design time it displays properly at runtime it reverts back to the original.

I'd like to learn how to use the Action Manager and Action Main Menu Bar but I can find any help on these topics. Is there a tutorial on how to use the Action Manager and Action Main Menu Bar?

like image 326
Michael Riley - AKA Gunny Avatar asked Nov 25 '09 23:11

Michael Riley - AKA Gunny


2 Answers

  1. Drag and drop a ActionManager, a ActionMainMenuBar and a ImageList on your form.
  2. Doubleclick the ImageList, you get the Imagelist Editor. Use the Add-button to add your icons (make sure their sizes are the same as the Height and Width properties that are set in the ImageList-control).
  3. Set the Images-property of the ActionManager to your ImageList and set the ActionManager-property of your ActionMainMenuBar to your ActionManager.
  4. Doubleclick the ActionManager, go to the tab 'Actions' and add new actions by the 'New'-button.
  5. Click each Action in the ActionManager and set each action's properties, at least: ImageIndex (to choose an Icon), Caption and Category. Note: A Category will serve as a main item in the menu (like File, Edit and View) and each Action will serve as menu item (like Save, Save as, Load). So set the Category property of all actions you want to belong to one main menu item to the same name. For instance give the actions 'Save' and 'Load' the category 'File' and give the actions 'Undo' and 'Redo' the category 'Edit'.
  6. Doubleclick each Action in the ActionManager. You'll get the code editor. Type the code you want to perform when the user clicks this menu item. If you don't type any code or comment, the menu item will automatically be disabled when the application is running.
  7. Now drag the categories from the ActionManager to the ActionMainMenuBar.

That's it.

like image 101
RR-NL Avatar answered Sep 27 '22 22:09

RR-NL


I think Actions, Action Lists And Action Managers by Brian Long is a great start to explore the realm of actions.

like image 24
Erwin Avatar answered Sep 28 '22 00:09

Erwin