Sign in Join

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

Mailing lists / lazarus / 2010-05

componentscount in panel

12 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

Fedorax

If i create components in a panel via a program file, something like:

With TDBEDIT.Create(Panel1) do begin
...
   Parent:=Panel1;
....
end;

Panel1.componentscount return the exact count of components in panel

I i put component in a panel from IDE Panel1.componentscount return always 0 All components make in IDE is child of main form, is there a solution for make them
childs of specific panel without check all existing components at start in a loop ?

Reply by email

Paul Ishenin
to Fedorax
Fedorax wrote 6 lines
I i put component in a panel from IDE Panel1.componentscount return always 0 All components make in IDE is child of main form, is there a solution for make them childs of specific panel without check all existing components at start in a loop ?

No. Form is the owner of all components. Use ControlCount for this case.

Best regards,
Paul Ishenin.

Reply by email

Martin
to Paul Ishenin
Paul Ishenin wrote 9 lines
12.05.2010 3:33, Fedorax wrote: > I i put component in a panel from IDE Panel1.componentscount return > always 0 > All components make in IDE is child of main form, is there a solution > for make them > childs of specific panel without check all existing components at > start in a loop ? No. Form is the owner of all components. Use ControlCount for this case.

TFrame ? doesn't that have it's own children?

Reply by email

Mattias Gärtner
to Graeme Geldenhuys: Ah, the "special" case. There is always an exception to every LCL rule. ;-) - Graeme -…

Zitat von Graeme Geldenhuys :

Show quoted text 5 lines
On 12 May 2010 00:31, Paul Ishenin wrote: > > Yes, but that is not a regular container. TFrame is a special case. Ah, the "special" case. There is always an exception to every LCL rule. ;-)

It's a FCL rule and it's not an exception.
It's just because Lazarus hides many gory details that you *think* that the rules are simple and uncommon cases like frames are exceptions.

Mattias

Reply by email

Paul Ishenin
to Mattias Gärtner
Mattias G?rtner wrote 9 lines
>> >> Yes, but that is not a regular container. TFrame is a special case. > > Ah, the "special" case. There is always an exception to every LCL > rule. ;-) It's a FCL rule and it's not an exception. It's just because Lazarus hides many gory details that you *think* that the rules are simple and uncommon cases like frames are exceptions.

I wrote special case because thread starter asked about ComponentCount. I supposed he don't know too deeply LCL or VCL and that's why I similified explanation and wrote that all components are owned by TForm. Frames and docked forms are more advanced things and that's why they are "special cases".

Best regards,
Paul Ishenin.

Reply by email

Joost van der Sluis
to Graeme Geldenhuys: Ah, the "special" case. There is always an exception to every LCL rule. ;-) - Graeme -…
Graeme Geldenhuys wrote 5 lines
On 12 May 2010 00:31, Paul Ishenin wrote: > > Yes, but that is not a regular container. TFrame is a special case. Ah, the "special" case. There is always an exception to every LCL rule. ;-)

If you're only reason to post a message is to bash the project, you can better not react, or do it elsewhere.

And to answer: (I should not do this, offcourse) That a TForm owns all components is not the rule, offcourse. But for a new user like Fedorax it's a good answer where he can work with. He didn't ask for a explanation of the deeper logic behind it. He needed the .ControlCount property.

Joost.

Reply by email

Graeme Geldenhuys
to Joost van der Sluis
Joost van der Sluis wrote
If you're only reason to post a message is to bash the project, you can better not react, or do it elsewhere.

Please re-read my earlier post and note the smiley face at the end of that comment. No bashing was intended, just a bit of humor (which some of you struggle to grasp it seems).

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/

Reply by email