| Class TMruMenu (unit MruMenu) |
TComponent
| Constructors |
constructor Create(AOwner: TComponent);| Functions |
procedure AddFile(fn : string);
procedure Clear;
procedure ConnectToMenu;
destructor Destroy;
procedure Loaded;
procedure Load_Files(const IniName: string);
function MruFilePath: string;
procedure Notification(AComponent: TComponent; Operation: TOperation);
procedure OnMenuClick(Sender: TObject);
procedure Save_Files(const IniName: string);
procedure UpdateMenu;| Properties |
property MruGroup : byte
property MruLocation : TMruLocation
property NumFiles : integer
property ParentGroup : byte
property ParentMenu : TMainMenu
property ShowPath : boolean| Events |
event OnSelectFile : TSelFileEvent| Variables |
Files : TStringList;
FMainMenu : TMainMenu;
FMruGroup : byte;
FMruLoc : TMruLocation;
FNumFiles : integer;
FOnSelFile : TSelFileEvent;
FParGroup : byte;
FShowPath : boolean;| Constructors |
constructor Create(AOwner: TComponent);Public declarations
| Functions |
procedure AddFile(fn : string);
procedure Clear;So the user can call it after changing all the properties
procedure ConnectToMenu;
destructor Destroy;This should be unique!
procedure Loaded;Add the new files to the bottom of the menu
procedure Load_Files(const IniName: string);Unhook from the Main Menu This is for the weird case where we get destroyed but the menu doesn't. It would be dangerous because the Menu OnClick events would be invalid. This section used to crash until I added a Notification handler.
function MruFilePath: string;Append them to the parent Menu
procedure Notification(AComponent: TComponent; Operation: TOperation);This procedure is necessary to properly unhook from the MainMenu. It basically handles the message when the MainMenu is destroyed before the MruMenu.
procedure OnMenuClick(Sender: TObject);-1 since its 0 indexed
procedure Save_Files(const IniName: string);
procedure UpdateMenu;Bring it to the top of the list
| Properties |
property MruGroup : byte
property MruLocation : TMruLocation
property NumFiles : integer
property ParentGroup : byte
property ParentMenu : TMainMenu
property ShowPath : boolean| Events |
event OnSelectFile : TSelFileEventPublished declarations
| Variables |
Files : TStringList;Determines if file Path is displayed in the menu
FMainMenu : TMainMenu;This event fires when the user selects an Mru file on the menu
FMruGroup : byte;The GroupIndex of the Main Menu Item to append to (usually File = 0
FMruLoc : TMruLocation;Holds the Mru files
FNumFiles : integer;Unique Group Num given to Mru Menu Items. Needed to delete ONLY the Mru Menu items.
FOnSelFile : TSelFileEvent;
FParGroup : byte;The Parent Menu used to append the Mru file list
FShowPath : boolean;Max number of Mru files (default is 4