Recent

Author Topic: Extended MRUMenuManager  (Read 2489 times)

wp

  • Hero Member
  • *****
  • Posts: 6231
Extended MRUMenuManager
« on: October 09, 2011, 04:48:44 pm »
Recently I came across the MRUMenu component which implements a recent file menu that I was missing so far.

The MRUMenuManager, however, adds a recent file menu only to the mainmenu, not to the toolbar. Therefore, I modified the component such that a popup menu can be populated by the recent file items as well. This popup menu then can be assigned to a toolbutton with tbsDropdown style.

Another modification is the length of the menu items. Now a MaxItemLength property defines the maximum string length of a menu item. If the length is greater inner segments of the file path are removed and replaced by '...' until the length criterion is met.

Finally, I made the format mask of the menu items (presently '%d.  %s') a changeable property if a different format might be required.

The source codes of the modified component and demo program are enclosed in the attachment. If these changes are of any interest feel free to incorporate them into the main component.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10