Dynamic creation of TCategoryPanel

Hello!

I got the following problem. During run-time I want to add 1..n components of type "TCategoryPanel" to a "TCategoryPanelGroup" but the only method (CreatePanel) offered by "TCategoryPanelGroup" to add a new panel returns a "TCustomCategoryPanel". I cannot do this in the editor during design time for I do not know how much Panels I´m gonna need.In the editor it is just a right click "New Panel" => Done! , but I´m stuck whith this thing in run-time.

I have to use the TCategoryPanel and not the TCustomCategoryPanel for it has the Caption property I would like to use...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
TCategoryPanel *cp;

	cp = new TCategoryPanel(cpg1); // cpg1 = TCategoryPanelGroup
	cp->Caption = "Test";
	cp->Height = 100; cp->Width = 100;
        cp->Parent = cpg1;
        cp->PanelGroup = cpg1;
	cpg1->Panels->Count +=1;
	cpg1->Panels->Items[0] = cp; // Does not show up with or without the two lines of cp->Parent = cpg1; and cp->PanelGroup = cpg1;
        
        // Works (shows up) but does not have the Caption and other properties
        //TCustomCategoryPanel *ccp = new TCustomCategoryPanel(this);
	//ccp = cpg1->CreatePanel(cpg1);

Hope someone can help me.... Thanks for your comments!
Topic archived. No new replies allowed.