Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvPanel
Programmatically adding and removings panels in TAdvPanelGroup

It is simple to programmatically add a TAdvPanel to a TAdvPanelGroup. Three methods are available for this:
  • AdvPanelGroup.AddPanel: TAdvPanel; adds a panel on top of existing panels in the group
  • AdvPanelGroup.InsertPanel(index: Integer): TAdvPanel; inserts a panel at position index in the group
  • AdvPanelGroup.AppendPanel: TAdvPanel; adds a panel at last position in a group
This code snippet inserts a panel and sets its text:
  with AdvPanelGroup1, AdvPanelGroup1.AppendPanel do
    begin
      Text := 'panel'+inttostr(PanelCount);
      Caption.Visible := true;
      Caption.Text := 'Programmatically inserted panel';
      Caption.MinMaxButton := true;
    end;  
This code removes the panel at index X again from the panelgroup:
  begin
      AdvPanelGroup1.RemovePanel(0);
    end;  
Finally, it is also possible to change the order of panels at runtime. This can be done with the method TAdvPanelGroup.MovePanel(FromIndex, ToIndex);
This code snippet moves the last panel to the first position:
begin
    AdvPanelGroup1.MovePanel(AdvPanelGroup1.PanelCount - 1,0);
  end;