Ignore:
Timestamp:
Mar 18, 2022, 1:37:03 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Update Common package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/ULastOpenedList.pas

    r122 r131  
    3030    procedure SaveToXMLConfig(XMLConfig: TXMLConfig; Path: string);
    3131    procedure AddItem(FileName: string);
     32    function GetFirstFileName: string;
    3233  published
    3334    property MaxCount: Integer read FMaxCount write SetMaxCount;
     
    8384destructor TLastOpenedList.Destroy;
    8485begin
    85   Items.Free;
     86  FreeAndNil(Items);
    8687  inherited;
    8788end;
     
    9394begin
    9495  if Assigned(MenuItem) then begin
    95     MenuItem.Clear;
     96    while MenuItem.Count > Items.Count do
     97      MenuItem.Delete(MenuItem.Count - 1);
     98    while MenuItem.Count < Items.Count do begin
     99      NewMenuItem := TMenuItem.Create(MenuItem);
     100      MenuItem.Add(NewMenuItem);
     101    end;
    96102    for I := 0 to Items.Count - 1 do begin
    97       NewMenuItem := TMenuItem.Create(MenuItem);
    98       NewMenuItem.Caption := Items[I];
    99       NewMenuItem.OnClick := ClickAction;
    100       MenuItem.Add(NewMenuItem);
     103      MenuItem.Items[I].Caption := Items[I];
     104      MenuItem.Items[I].OnClick := ClickAction;
    101105    end;
    102106  end;
     
    185189end;
    186190
     191function TLastOpenedList.GetFirstFileName: string;
     192begin
     193  if Items.Count > 0 then Result := Items[0]
     194    else Result := '';
     195end;
     196
    187197end.
    188198
Note: See TracChangeset for help on using the changeset viewer.