[Lazarus] ComponentCount

2013-11-05 Thread Antonio Fortuny

Hi Folks.

I've a problem with the TComponent.ComponentCount. Lazarus 1.0.12, FPC 
2.6.2, WIn Vista32
Onto a TForm, at design time, I drop a TPanel (named MyPanel). Into 
MyPanel I drop half a dozen inside TPanel's.
These have been dropped doing: 1.)select MyPanel first, 2.) then drop 
inside TPamel).

When I move the MyPanel, all inside panels move too.
At runtime, when in the TForm.CreateForm event I execute a
wCount := ComponentCount;
displays 15 which is the total components count onto the form, 
irrespective of the containers

wCount := MyPanel.componentCount;
wCount appears to be 0 (zero) :-\   as if MyPanel wasn't a container 
(Parent property didn't work at design time ?)
Some lines later, after having dynamically created 6 Tpanels inside the 
MyPanel I do (still in Create event):

wCount := MyPanel.componentCount;
which gives 6 as count which is the number of TPanel's added
wCount := ComponentCount;
whish shows 15, the initial TForm.ComponentCount
This time, at form level wCount is exactly the number of components onto 
the form irrespective of the containers wich

Some time lated into the MyForm.OnShow event I display again the counts:
wCount := MyPanel.componentCount; shows 6
wCount := ComponentCount; shows 15: same as in the beginning, where 
are gone the 6 dynamically added panels ?
This leads me to assume that, at design time, the main form appears to 
be the parent of all newly dropped TComponent descendants. Right ?

Did I miss something ?

Antonio.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] ComponentCount

2013-11-05 Thread Mattias Gaertner
On Tue, 05 Nov 2013 11:14:55 +0100
Antonio Fortuny a.fort...@sitasoftware.lu wrote:

 Hi Folks.
 
 I've a problem with the TComponent.ComponentCount. Lazarus 1.0.12, FPC 
 2.6.2, WIn Vista32
 Onto a TForm, at design time, I drop a TPanel (named MyPanel). Into 
 MyPanel I drop half a dozen inside TPanel's.
 These have been dropped doing: 1.)select MyPanel first, 2.) then drop 
 inside TPamel).

Maybe you are searching for ControlCount?

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] ComponentCount

2013-11-05 Thread Antonio Fortuny


Le 05/11/2013 11:30, Mattias Gaertner a écrit :

On Tue, 05 Nov 2013 11:14:55 +0100
Antonio Fortuny a.fort...@sitasoftware.lu wrote:


Hi Folks.

I've a problem with the TComponent.ComponentCount. Lazarus 1.0.12, FPC
2.6.2, WIn Vista32
Onto a TForm, at design time, I drop a TPanel (named MyPanel). Into
MyPanel I drop half a dozen inside TPanel's.
These have been dropped doing: 1.)select MyPanel first, 2.) then drop
inside TPamel).

Maybe you are searching for ControlCount?

Yep, it did it.
Thanks Mattias.

Antonio.


Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus






--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus