Back to Devexpress

TdxBarMRUListItem Class

vcl-dxbarextitems-81edec0b.md

latest2.4 KB
Original Source

TdxBarMRUListItem Class

TdxBarMRUListItem is used to represent a list of most recently used (MRU) items within toolbars.

Declaration

delphi
TdxBarMRUListItem = class(
    TdxBarListItem
)

Remarks

TdxBarMRUListItem allows you to implement a list of most recently used (MRU) items into your application. This feature can dramatically extend the functionality of your application. For instance, you can use this item to display the list of recently used files in a submenu. This list changes when you close file.

The following procedure adds the closed file to the MRU file list:

procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if MainForm.FileName <> '' then
    MainForm.dxBarMRUFiles.AddItem(MainForm.FileName, nil);
  Action := caFree;
end;

The following procedure uses the MRU list to open one of the recently used files:

procedure TMainForm.dxBarMRUFilesClick(Sender: TObject);
var
  AFileName: String;
begin
  AFileName := dxBarMRUFiles.Items[dxBarMRUFiles.ItemIndex];
  if FileExists(AFileName) then
    with TChildForm.Create(Application) do
    begin
      FileName := AFileName;
      Editor.Lines.LoadFromFile(FileName);
      SetModified(False);
    end
  else
    Application.MessageBox(PChar(AFileName+#10#13+'File not found.'),'Open',MB_OK or MB_ICONERROR)
end;

Inheritance

Show 11 items

TObject TPersistent TComponent TcxCustomComponent TdxBarComponent TdxBarItem TdxBarButtonLikeItem TCustomdxBarSubItem TCustomdxBarContainerItem TdxBarListItem TdxBarMRUListItem

See Also

TdxBarContainerItemControl

List of Bar Item Types

TdxBarMRUListItem Members

dxBarExtItems Unit