TmoHotkeyLister Beta

Last updated 12/08/04.

This handy little component will list the hotkeys of all the menu items on a given form in TreeView. Currently only available for Delphi 2.0 (1.0 version in the works)

The TmoHotkeyLister is perfect for applications whose hotkeys may change -- because the application is not yet complete, or because you have given your users the ability to change their hotkeys. Now you don't have to change your help file when you change your application's hotkeys, or worry about how users will remember what they changed the keys to. Think of it as instant help!

Download Download it!

This component will install itself on the Sample page of your component palette.

TmoHotkeyLister is a simple descendant of TTreeView, and has all properties of TTreeView plus:


What it does:

The TmoHotkeyLister will display only menu items belonging to a TMainMenu that have a ShortCut assigned -- and their "parent" items. The Caption of each MenuItem is displayed, followed by its Hint (if non-blank) in parenthesis, a colon and the ShortCut as a string. The "&" character is omitted from the Caption. is omitted

Suggested use:

Place the TmoHotkeyLister alone on a form and set the Align property to alClient. At runtime, in the OnCreate event, set the MenuForm to the form containing the menu you would like to display (make sure that the form containing the menu has created first), then call the Execute procedure.
Add a MenuItem to your "Main" form (probably under Help) to list the Hotkeys, and display this form when it is chosen.

Planned changes:

I am trying to figure out a way to be able to assign the MenuForm property at design time; this will also allow me to make the Execute method available at design time from the context editor. In order to do this, I may need to change the property's type from TForm to TMainMenu, and allow you to specify the name of a menu on another form.
In addition, I may add a Print method to make it easy to print out the entire list -- even if it doesn't fit within the visible area of the form.

In case you care, How I did it:

The AddMenuItem procedure is the workhorse of this component.
The code involved in getting the "child" menu items to display as subordinates of their "parents" was the trick to creating this thing -- when your MenuItems have submenu items, AddMenuItem procedure must call itself recursively.
Code also had to be written to delete any "parent" items that turned out to have no subordinates with ShortCut keys.
Read the code and enjoy...

Notes and disclaimer:

Note that the component's version is "beta" -- I have only used it in one application, so perhaps there are problems I failed to detect. If you encounter a problem, have a suggestion, or would like to be notified when the component is updated, please send me email at: mmowens at panix dot com.
DISCLAIMER: I have provided these components and source code to the public free of charge. You accept these components AS IS without any representation or warranty of any kind, including but not limited to the warranty of merchantability or fitness for a particular purpose. You may not sell these components.

[ My home page] [ My Delphi pages] [My Components]



©1996 Maggie Owens.