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
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to