Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ControlCount or ComponentCount, difference?

334 views
Skip to first unread message

Tom Macadam

unread,
Jul 18, 1997, 3:00:00 AM7/18/97
to

On the subject of designing programs to work with all screen resolutions, I've
come across a number of procedures that are supposed to loop through all the
'controls' (ie. buttons, edit boxes, labels, whatever) and suitably scale their
font sizes depending on the user's screen resolution. One thing I'm curious
about, however, is that I've seen versions of the loop that run from

ComponentCount-1 downto 0

and versions that run from

ControlCount-1 downto 0

What is the difference (if any) between these two loops. Which would be most
appropriate for the above situation?

TIA,
Tom.


--
Tom MacAdam (lmsv...@linden.msvu.ca)

HUBERT Yvon

unread,
Jul 18, 1997, 3:00:00 AM7/18/97
to

Tom Macadam wrote:

> What is the difference (if any) between these two loops. Which would be most
> appropriate for the above situation?
>

It's easy to understand :

ComponentCount -> All the components on the form and that you can find
on your component's toolbar.

ControlCount -> Component + other controls like another form created by
the parent.


Yvon HUBERT.
"Silence Has No Mean"

Martin Masse

unread,
Jul 18, 1997, 3:00:00 AM7/18/97
to

From the Delphi Help File

->The ControlCount property indicates the number of controls that are
CHILDREN of the windowed control.
The control is the PARENT of those controls.

->ComponentCount indicates the number of components OWNED by the component
as listed in the Components array property list.
The Control is the OWNER of those controls.

Example: - if you want to cycle trough all components in a form, even if
they are in a tab control, you should use
ComponentCount.

- if you want to cycle trough all components directly in a form, you
should use ControlCount.

Hope this help!!!
--
Martin Massé
ObjectLab Enr.
martin...@videotron.ca


Chuck Gadd

unread,
Jul 19, 1997, 3:00:00 AM7/19/97
to

On 18 Jul 1997 13:11:42 GMT, LMSV...@LINDEN.MSVU.CA (Tom Macadam)
wrote:

>What is the difference (if any) between these two

The D1 helpfile seems to clear it up real nice....

<quote on>
Don't confuse the Controls property with the Components property. The
Components property lists all components that are owned by the
component, while the Controls property lists all the controls that are
child windows of the control.

All components put on a form are owned by the form, and therefore,
they appear in the form's Components property list.

For example, if you put a control in a group box, the form still owns
the control, but the control's window parent is the group box control,
and therefore, is listed in the group box's Controls property array.
<quote off>

So, if you are resizing from the FORM, I think you would use the
Components and ComponentCount properties.

Chuck Gadd
Director of Software Development, Cyber FX Communications.
e-mail:cgadd-...@cyber-fx.com http://www.csd.net/~cgadd
Remove the -NOSPAM from my email address to send me e-mail.
*** I boycott businesses that send me unsolicited email advertisements ***

0 new messages