Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi - Making a user control a container without inheriting from an existing container

I need to make a control a conainter(that holds other controls at design and run time) similiar a TPanel, without inheriting from the custom panel or a similar control, how do i tell my control that its suppose to contain stuff???

like image 752
Infernus Avatar asked Aug 18 '10 01:08

Infernus


1 Answers

You need to add the csAcceptsControls style to your control's ControlStyle property. Something like this in the constructor of your control class:

  ControlStyle := ControlStyle + [csAcceptsControls];

You will almost certainly want to set other ControlStyle properties also though so don't just take this verbatim but research the ControlStyle flags and decide which are appropriate in your case.

like image 183
Deltics Avatar answered Sep 28 '22 21:09

Deltics