Search code examples
delphivcltcategorypanelgroup

How to dynamically add panels to TCategoryPanelGroup?


How to dynamically I can add panels to an TCategoryPanelGroup.

Give me a example please, thanks.

This i tried so far.

procedure TWForm.BitBtn3Click(Sender: TObject);
var 
  categorypanel: tcategorypanel;
begin
  categorypanel := categorypanel.Create (categorypanelgroup1);
  categorypanel := tcategorypanel.Create(self);
  categorypanel.caption:=edit1.text;
end;

Solution

  • You must create the component and then set the PanelGroup property of the CategoryPanel with the CategoryPanelGroup.

    Var
     LPanel : TCategoryPanel;
    begin
     LPanel:=TCategoryPanel.Create(CategoryPanelGroup1);
     LPanel.Caption:='My Panel';
     LPanel.PanelGroup:=CategoryPanelGroup1;
    end;