Control Name | Unit | Class |
RX MRU [Most Recently
Used] List or Manager |
MRUList | TMRUManager |
Description:
This component
greatly simplifies adding MRU (More Recently Used) object lists
(i.e. file descriptions) to the application menus.
Example Usage:
It is somewhat difficult to explain what the MRU manager
does, and is best explained by an example:
Under the File menu, I have a sub-menu called "Recent".
So, under the RecentMenu property of the MRUManager, I have this
menu item. I save up to 10 recently used files in the registry.
The call I use to load these files from the registry is:
MRUManager.LoadFromRegistry(EMIni.CSRegistry,'Recent');
where EMIni.CSRegistry is the registry key and recent is the section. Check out the Rx code in the MRUList.PAS unit for any more details on this. To save a file to the MRUManager, I use:
MRUManager.Add(OpenDialog.Filename,0)
Where OpenDialog.Filename is the name of the file to be added to the list and 0 is a UserData flag which I don't use. Again, the MRUList.PAS has the source for this.
Then, when I close my program, I save the info which was added to the MRUManager by calling:
MRUManager.SaveToRegistry(EMIni.CSRegistry,'Recent');
Property AccelDelimiter
Declaration:
AccelDelimiter: TAccelDelimiter;
This defines the accelerated
delimited.
In other words: Since "&" cannot be stored in, it
is substituted to either a tab or space instead. The property
AccelDelimiter sets this.
Property AutoEnable
Declaration:
AutoEnable: Boolean;
AutoEnable property automatically enables the MRU manager on
startup and shutdown of the form.
In other words, all the processing is done automatically for you.
Property AutoUpdate
Declaration:
AutoUpdate: Boolean;
Set AutoUpdate to true, the MRU is
automatically updated.
In other words, the MRU manager automatically processes and
updates itself automatically when AutoUpdate property is true.
Property Capacity
Declaration:
Capacity: Integer;
Capacity is the maximum number of strings the MRU list can hold. Adding new strings will delete oldest strings if necessary.
Property Mode
Declaration:
Mode: TRecentMode;
Property mode controls how the entries are added into the system.
They are either:
- mrInsert - inserted into the most recently used list.
- mrAppend - appended into the most recently used list.
Property RecentMenu
Declaration:
RecentMenu: TMenuItem;
RecentMenu is the last or recent menu that would be utilised.
Property RemoveOnSelect
Declaration:
RemoveOnSelect: Boolean;
RemoveOnSelect defines whether the most recently used entry is deleted when the entry is selected.
Property
SeparateSize
Declaration:
SeparateSize: Word;
SeparateSize - separate size is the MRU manager's stuff.
Property
ShowAccelChar
Declaration:
ShowAccelChar: Boolean;
ShowAccelChar property defines whether the Accelerated
Property
StartAccel
Declaration:
StartAccel: Cardinal;
StartAccel defines if the each member of the MRU list should start with an accelerated character.
Property
Strings
Declaration:
Strings: TStrings;
Strings property can be used to direst access to list of elements stored in the TMRUManager component. By using this property you can assign MRU-strings to another controls, for example, to list-boxes or to combo-boxes:
ListBox1.Items := MRUManager1.Strings;
Event
OnChange
Declaration:
OnChange: TNotifyEvent;
OnChange occurs immediately after the list of MRU-strings changes. Write an OnChange event handler to respond to changes in the list of MRU-elements. For example, if you are using MRU-strings in a control (list-box, combo-box or another), the OnChange event handler could be used to change string list associated with a control.
Event
OnClick
Declaration:
OnClick: TClickMenuEvent;
OnClick event is triggered when the menu item in the MRU list is clicked.
Event
OnGetItemData
Declaration:
OnGetItemData: TGetItemEvent;
OnGetItemData event is triggered when an item is retrieved from the MRU list.
Event
OnReadItem
Declaration:
OnReadItem: TReadItemEvent;
OnReadItem event is triggered when an item or data is read into the MRU list.
Event
OnWriteItem
Declaration:
OnWriteItem: TWriteItemEvent;
OnWriteItem event is triggered when an item or data is written into the MRU list.
Method
Add
Declaration:
procedure Add(const RecentName: string; UserData: Longint);
procedure Add adds an entry RecentName to the MRU list and UserData.
Method
LoadFromIni
Declaration: procedure LoadFromIni(Ini: TIniFile; const Section:
string);
LoadFromIni loads the MRU list from the INI file.
Method
LoadFromRegistry
Declaration: procedure LoadFromRegistry(Ini: TRegIniFile; const
Section: string);
LoadsFromRegistry loads the MRU list from the registry.
Method
Remove
Declaration:
procedure Remove(const RecentName: string);
Remove a single item from the list. No error occured when item not found.
Method
SaveToIni
Declaration: procedure SaveToIni(Ini: TIniFile; const Section:
string);
SaveToIni procedure saves the MRU list to an INI file instead.
Method
SaveToRegistry
Declaration: procedure SaveToRegistry(Ini: TRegIniFile; const
Section: string);
SaveToRegistry saves the MRU list is the registry.
Method
UpdateRecentMenu
Declaration: procedure UpdateRecentMenu;
UpdateRecentMenu updates the MRU list. Use this if the autoupdate property is false and you want to update the MRU list manually instead.
Type
TAccelDelimiter
Declaration: TAccelDelimiter = (adTab, adSpace);
TAccelDelimiter is a set of values for the AccelDelimiter property of the TMRUManager component.
Type TClickMenuEvent
Declaration: TClickMenuEvent = procedure (Sender:
TObject; const RecentName, Caption: string; UserData: Longint) of
object;
TClickMenuEvent is the type of the OnClick event of the TMRUManager component.
Declaration: TGetItemEvent = procedure (Sender: TObject; var Caption: string; var ShortCut: TShortCut; UserData: Longint) of object;
TGetItemEvent is the type of the OnGetItemData event of the TMRUManager component.
Type
TReadItemEvent
Declaration: TReadItemEvent = procedure (Sender:
TObject; IniFile: TObject; const Section: string; Index: Integer;
var RecentName: string; var UserData: Longint) of object;
TReadItemEvent is the type of the OnReadItem event of the TMRUManager component.
Type
TRecentMode
Declaration: TRecentMode = (rmInsert, rmAppend);
TRecentMode is a set of values for the Mode property of the TMRUManager component.
Type
TWriteItemEvent
Declaration: TWriteItemEvent = procedure (Sender:
TObject; IniFile: TObject; const Section: string; Index: Integer;
const RecentName: string; UserData: Longint) of object;
TWriteItemEvent is the type of the OnWriteItem event of the TMRUManager component.
Index Page | About | Download
Creation Date: 4 Feb 1998 | Last Update: 16 Mar 2000