Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-11

ComponentCount

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131105/0db15c9a/attachment.html>

Reply by email

Mattias Gaertner
to Antonio Fortuny
Show quoted text 8 lines
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

Reply by email

Antonio Fortuny
to Mattias Gaertner

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

Show quoted text 12 lines
On Tue, 05 Nov 2013 11:14:55 +0100 Antonio Fortuny 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.

Show quoted text 9 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email