Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxBarListItem Example

The following code demonstrates organization of MDI child lists with the help of the TdxBarListItem object. If the ShowCheck property of a given class is equal to True, then at the current item (in our case it is the current MDI child form) a “check” is displayed. While selecting any window from the list, it becomes active - While destroying - it removes the corresponding string. This example assumes that the window caption contains the file name. With the change of this name, the caption and the corresponding string in the MDI child list also changes.

Delphi
MainForm: TMainForm;
dxBarListWindows: TdxBarListItem;
dxBarListWindows.ShowCheck := True;
// ...
//In MDI child (TChildForm.FormStyle = fsMDIChild):
procedure TChildForm.FormCreate(Sender: TObject);
begin
  Inc(MainForm.CreatedMDICount);
  Caption := 'Document' + IntToStr(MainForm.CreatedMDICount);
  MainForm.dxBarListWindows.Items.AddObject(Caption, Self);
end;
procedure TChildForm.FormDestroy(Sender: TObject);
begin
  with MainForm.dxBarListWindows.Items do
    Delete(IndexOfObject(Self));
end;
procedure TChildForm.SetFileName(Value: string);
var
  I: Integer;
begin
  Caption := Value;
  with MainForm.dxBarListWindows do
  begin
    I := Items.IndexOfObject(Self);
    if (0 <= I) and (I < Items.Count) then Items[I] := Value;
  end;
end;
// in MDI frame (TMainForm.FormStyle = fsMDIForm):
procedure TMainForm.dxBarListWindowsGetData(Sender: TObject);
begin
  with dxBarListWindows do
    ItemIndex := Items.IndexOfObject(ActiveMDIChild);
end;
procedure TMainForm.dxBarListWindowsClick(Sender: TObject);
begin
  with dxBarListWindows do
    if ItemIndex > -1 then
      TCustomForm(Items.Objects[ItemIndex]).Show;
end;