[Lazarus] TTabsheet componentcount property always seems to show 0

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sun Nov 4 06:09:18 CET 2012


Ajeandro Gonzalo schrieb:
> Thank you, that works.  It's curious that componentcount compiles for
> the tabsheet in the first place.

Every TWinControl has both Components and Controls arrays, you cannot 
get compiler errors here. Components[] lists the controls *owned* by the 
TWinControl (Owner property), while Controls[] lists the controls which 
are visual children (sub-windows) of the control (Parent property).

The form designer adds all controls as owned by the form, but controls 
added by code can have different Owners. I'm not sure of other possible 
designers, which may add controls to other owners. E.g. a frame will own 
all its components, so that you never will find such controls in a 
form's lists.

DoDi





More information about the Lazarus mailing list