- Timestamp:
- May 22, 2012, 1:45:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/ULastOpenedList.pas
r329 r366 13 13 14 14 TLastOpenedList = class(TStringList) 15 private 16 FOnChange: TNotifyEvent; 15 17 public 16 18 MaxCount: Integer; 17 MenuItem: TMenuItem;18 19 ClickAction: TNotifyEvent; 19 20 constructor Create; 20 21 destructor Destroy; override; 21 procedure ReloadMenu;22 procedure LoadToMenuItem(MenuItem: TMenuItem); 22 23 procedure LoadFromRegistry(Root: HKEY; Key: string); 23 24 procedure SaveToRegistry(Root: HKEY; Key: string); 24 25 procedure AddItem(FileName: string); 26 property OnChange: TNotifyEvent read FOnChange write FOnChange; 25 27 end; 26 28 … … 40 42 end; 41 43 42 procedure TLastOpenedList. ReloadMenu;44 procedure TLastOpenedList.LoadToMenuItem(MenuItem: TMenuItem); 43 45 var 44 46 NewMenuItem: TMenuItem; … … 60 62 I: Integer; 61 63 Registry: TRegistryEx; 64 FileName: string; 62 65 begin 63 66 Registry := TRegistryEx.Create; … … 69 72 I := 0; 70 73 while ValueExists('File' + IntToStr(I)) and (I < MaxCount) do begin 71 inherited Add(UTF8Encode(ReadStringWithDefault('File' + IntToStr(I), ''))); 74 FileName := UTF8Encode(ReadStringWithDefault('File' + IntToStr(I), '')); 75 if Trim(FileName) <> '' then inherited Add(FileName); 72 76 Inc(I); 73 77 end; 74 ReloadMenu; 78 if Assigned(FOnChange) then 79 FOnChange(Self); 75 80 finally 76 81 Free; … … 101 106 Delete(Count - 1); 102 107 103 ReloadMenu; 108 if Assigned(FOnChange) then 109 FOnChange(Self); 104 110 end; 105 111
Note:
See TracChangeset
for help on using the changeset viewer.