Sign in Join

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

Mailing lists / lazarus / 2012-11

TTabsheet componentcount property always seems to show 0

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Ajeandro Gonzalo

Am I missing something?

Also, in Form OnShow, using setfocus on a tabsheet component gives an error message, but activecontrol:= works.

Not earthshaking, but now that Laz actually is usable perhaps now is the time to bring up the little things.

A. G.

Reply by email

Ajeandro Gonzalo
to Paul Ishenin

Thank you, that works. It's curious that componentcount compiles for the tabsheet in the first place.

A. G.

Paul Ishenin wrote 20 lines
From: Paul Ishenin Subject: Re: [Lazarus] TTabsheet componentcount property always seems to show 0 To: "Lazarus mailing list" Date: Saturday, November 3, 2012, 1:53 AM 03.11.12, 4:38, Ajeandro Gonzalo ?????: > Am I missing something? All components are owned by TForm. Check for TTabSheet controlCount. Best regards, Paul Ishenin -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Frank Church
to Ajeandro Gonzalo
Ajeandro Gonzalo wrote
Thank you, that works. It's curious that componentcount compiles for the tabsheet in the first place.

Can we see the code?

Show quoted text 32 lines
A. G. --- On Sat, 11/3/12, Paul Ishenin wrote: > From: Paul Ishenin > Subject: Re: [Lazarus] TTabsheet componentcount property always seems to show 0 > To: "Lazarus mailing list" > Date: Saturday, November 3, 2012, 1:53 AM > 03.11.12, 4:38, Ajeandro Gonzalo > ?????: > > Am I missing something? > > All components are owned by TForm. Check for TTabSheet > controlCount. > > Best regards, > Paul Ishenin > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121103/41590661/attachment.html>

Reply by email

Paul Ishenin
to Ajeandro Gonzalo: Thank you, that works. It's curious that componentcount compiles for the tabsheet in the…

04.11.12, 2:10, Ajeandro Gonzalo ?????:

Thank you, that works. It's curious that componentcount compiles for the tabsheet in the first place.

TTabSheet can also own something. For example you can write the next code:

NewBtn := TButton.Create(TabSheet1);

After that a TabSheet1 will own a TButton and componentCount will show that.

At the same time you can place this button on another control:

NewBtn.Parent := TabSheet2;

Which result in showing of that Button on TabSheet2 which is owned by TabSheet1.

So TabSheet1.Components[] will contain NewBtn but TabSheet1.Controls[] will not have it and vice versa with TabSheet2.

Best regards,
Paul Ishenin

Reply by email

Hans-Peter Diettrich
to Ajeandro Gonzalo: Thank you, that works. It's curious that componentcount compiles for the tabsheet in the…
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

Reply by email