Each bigger Windows application maintains a "MRU" list (most recently used) or a list of currently opend windows, files etc.. To do this by "hand" seems to be a complicated story. TFlexMenu component enables you to add or remove itmes on a menu dynamicly.

TFlexMenu component enables you to add or remove itmes on a menu dynamicly. Useful for flexibe menu entries like MRU or window lists. TFlexMenu features automatic numbering of the added menuitems and automatic add/remove of separator lines. TFlexMenu is a non visual component.

It provides the following properties and methods:

Download

Download file includes:

  • FlexMenu component
  • Full source code
  • Freeware!

Download

Properties:
MaxItems
Number of menuitems that can be added to the menu. -1 means that there is no limit. If you set a Limit, not more than MaxItems entries are added to the parent menu.
ParentMenu
The TMenuItem that the Subitems are added to, NumberItems true means, that the entries are numberd by TFlexMenu. Example:1 Entry No. one
2 Entry No. two
3 Entry No. three
4 Entry No. four

If you remove "Entry No. two" the items will be automaticly renumberd and then look like this:

1 Entry No. one
2 Entry No. three
3 Entry No. four

If NumberItems is TRUE, the Number is the Shotcut to the MenuItem! CreateLine IF true, The first added menuitem also adds a separator line to the menu. The line is automaticly removed, if all menus that are added are removed.

Methodes:
Create
Creates the component
Destroy
Destroys the component
Add
Adds a menuitem to the parent menu. The methode returns the added Menuitem as a TMenuItem object.
Remove
Removes the menuitem from the parent menu.
ChangeCaption
Changes the Caption of the menuitem. You should always use this methode instead manipulating the menuitem in direct way, because ChangeCaption updates the numbering.
GetItem
Returns the TMenuItem with the specific number from the list of the added menuitems, or NIL if the item not exist.