Pieter van Wyk
Pieter van Wyk

Reputation: 2378

TFlowPanel. Adding controls at run-time

Does anybody know how to add controls, say a TImage, to a TFlowPanel at runtime?

Regards, Pieter

Upvotes: 3

Views: 5621

Answers (2)

eTomm
eTomm

Reputation:

There is just a slight difference with a normal container, you can set the order of the child controls.

OldIndex:= FlowPanel.GetControlIndex( MyControl );     
FlowPanel.SetControlIndex( MyControl, OldIndex + 1 ); 

Upvotes: 8

Toon Krijthe
Toon Krijthe

Reputation: 53366

To add any control to a parent control:

MyControl := TMyControl.Create(MyForm); // Form is the owner
MyControl.Parent := ParentControl;      // Parent control is the parent

You can set other properties too if you like.

Upvotes: 7

Related Questions