Class TMRUFileList (unit MRUFList)

Inherits from

TComponent

Constructors


constructor Create(Owner: TComponent);

Needs to do nothing more than initialize properties to defaults and create } { the list variable.


Functions

procedure AddItem(aFile: string);

Yes, redo the menu.

procedure AddStringList(Files: TStringList);

Yes, redo the menu.

procedure AddStrings(Files: TStrings);

Update menu now that all are added.

procedure ClearAllItems;

Method to clear all current MRU items.

procedure ClearItem (aFile: string);

Method to clear a single item by name from the MRU items.

destructor Destroy;


procedure InsertItem(Index: integer; aFile: string);

Methods to add items to the MRU list

Call the users event handler.


function Load: boolean;

Methods to load and save items.

procedure RemoveAllItems;

Method to remove all MRU items from the menu, but NOT from the internal } { list.

procedure ReplaceItem(OldItem, NewItem: string);

Yes, redo the menu.

function Save: boolean;


function GetVersion: TDFSVersion;


procedure Loaded;

Cleanup the list variable

procedure MRUClicked(Sender: TObject);

MenuItem OnClick handler

procedure Notification(AComponent: TComponent; Operation: TOperation);

We need to know if our menu item is deleted.

procedure PopulateMenu;

Method to place items on menu

Update menu now that all are added.


procedure SetAutoSaveName(const Val: string);

Value not different, do nothing.

procedure SetFileMenu(Val: TMenuItem);

Note: an ELSE clause is not needed since if new value is more than old, } { nothing needs to be done.

procedure SetInsertSeparator(Val: boolean);

Redo the menu according to new value.

procedure SetMaxCaptionWidth(Val: integer);

Redo the menu according to new value.

procedure SetMaximum(Val: byte);

Property methods

procedure SetSubmenuName(Val: string);


procedure SetUseSubmenu(Val: boolean);

Add MRU items to new menu.

procedure SetVersion(const Val: TDFSVersion);


Properties

property AddToTop : boolean


property AutoSave : boolean

Menu to place MRU items on.

property AutoSaveKey : string

The filename (INI) or key (registry) to save to.

property AutoSaveName : string

Save and restore MRU items automatically.

property FileMenu : TMenuItem

Event for MRU item selection

property InsertSeparator : boolean

MRU items placed on a submenu?

property MaxCaptionWidth : integer

The section to save to.

property Maximum : byte


property RemoveOnClick : boolean

Maximum number of items on MRU list

property SubmenuName : string


property UseSubmenu : boolean

Remove MRU item when selected?

property Version : TDFSVersion


property Items : TStringList

The MRU Items.

Events

event OnMRUItemClick : TMRUClick

Caption of submenu item, if needed

Variables

FAddToTop : boolean;

Property variables

FAutoSave : boolean;


FAutoSaveKey : string;


FAutoSaveName : string;


FFileMenu : TMenuItem;


FInhibitUpdate : boolean;

Internal use

FInsertSeparator : Boolean;


FMaxCaptionWidth : integer;


FMaximum : byte;


FMenuItems : TStringList;


FOnMRUClick : TMRUClick;

Event variables

FRemoveOnClick : boolean;


FSubmenuName : string;


FUseRegistry : boolean;


FUseSubmenu : boolean;



Constructors


constructor Create(Owner: TComponent);

Needs to do nothing more than initialize properties to defaults and create } { the list variable.


Functions


procedure AddItem(aFile: string);

Yes, redo the menu.


procedure AddStringList(Files: TStringList);

Yes, redo the menu.


procedure AddStrings(Files: TStrings);

Update menu now that all are added.


procedure ClearAllItems;

Method to clear all current MRU items.

Our placement menu item has been deleted.


procedure ClearItem (aFile: string);

Method to clear a single item by name from the MRU items.

Don't forget the object, too! - RGL


destructor Destroy;


procedure InsertItem(Index: integer; aFile: string);

Methods to add items to the MRU list

Call the users event handler.


function Load: boolean;

Methods to load and save items.

redo the menu.


procedure RemoveAllItems;

Method to remove all MRU items from the menu, but NOT from the internal } { list. You probably want ClearAllItems.

Add to the menu


procedure ReplaceItem(OldItem, NewItem: string);

Yes, redo the menu.


function Save: boolean;


function GetVersion: TDFSVersion;


procedure Loaded;

Cleanup the list variable


procedure MRUClicked(Sender: TObject);

MenuItem OnClick handler


procedure Notification(AComponent: TComponent; Operation: TOperation);

We need to know if our menu item is deleted.


procedure PopulateMenu;

Method to place items on menu

Update menu now that all are added.


procedure SetAutoSaveName(const Val: string);

Value not different, do nothing.


procedure SetFileMenu(Val: TMenuItem);

Note: an ELSE clause is not needed since if new value is more than old, } { nothing needs to be done.


procedure SetInsertSeparator(Val: boolean);

Redo the menu according to new value.


procedure SetMaxCaptionWidth(Val: integer);

Redo the menu according to new value.


procedure SetMaximum(Val: byte);

Property methods


procedure SetSubmenuName(Val: string);


procedure SetUseSubmenu(Val: boolean);

Add MRU items to new menu.


procedure SetVersion(const Val: TDFSVersion);


Properties


property AddToTop : boolean


property AutoSave : boolean

Menu to place MRU items on.


property AutoSaveKey : string

The filename (INI) or key (registry) to save to.


property AutoSaveName : string

Save and restore MRU items automatically.


property FileMenu : TMenuItem

Event for MRU item selection


property InsertSeparator : boolean

MRU items placed on a submenu?


property MaxCaptionWidth : integer

The section to save to.


property Maximum : byte


property RemoveOnClick : boolean

Maximum number of items on MRU list


property SubmenuName : string


property UseSubmenu : boolean

Remove MRU item when selected?


property Version : TDFSVersion


property Items : TStringList

The MRU Items. Read Only.


Events


event OnMRUItemClick : TMRUClick

Caption of submenu item, if needed


Variables


FAddToTop : boolean;

Property variables


FAutoSave : boolean;


FAutoSaveKey : string;


FAutoSaveName : string;


FFileMenu : TMenuItem;


FInhibitUpdate : boolean;

Internal use


FInsertSeparator : Boolean;


FMaxCaptionWidth : integer;


FMaximum : byte;


FMenuItems : TStringList;


FOnMRUClick : TMRUClick;

Event variables


FRemoveOnClick : boolean;


FSubmenuName : string;


FUseRegistry : boolean;


FUseSubmenu : boolean;