Solved

Tabsheet componentCount returning always Zero ?

Posted on 2006-06-18
3
721 Views
Last Modified: 2010-05-18
Dear Experts,

when I Execute the following:

procedure TForm1.ClearForm(AForm : TsuiTabSheet);
var i : Integer;

begin

        begin
         For i := 0 to AForm.ComponentCount -1 do
             begin
               if (AForm.Components[i] is TcxTextEdit) then
                  begin
                     (AForm.Components[i] as tcxTextEdit).Text := '';
                  end;
             end;
       end;


end;

The TsuiTabSheet is a Tabsheet from a Page Control Component... since it was not working... I've checked the value returned
by AForm.ComponentCount and it is zero.

I would like to check all components on the The Tabsheet page and if they are TextEdit, clear their content...

any idea?

Thank you!

Dave
0
Comment
Question by:dcrudo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 16930043
You should try something like that

  for i := 0 to ComponentCount-1 do
    begin
    if Components[i] is TControl then
      begin
      if ((Components[i] as TControl).Parent.Name = 'TabSheet1')
        and (Components[i] is TEdit) then
        (Components[i] as TEdit).Text := '';
      end;
    end;

0
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 total points
ID: 16930710
use Controls, not Components
ie.

procedure TForm1.ClearForm(AForm : TsuiTabSheet);
var i : Integer;
begin
        begin
         For i := 0 to AForm.ControlCount -1 do
             begin
               if (AForm.Controls[i] is TcxTextEdit) then
                  begin
                     (AForm.Controls[i] as tcxTextEdit).Text := '';
                  end
             end;
       end;
end;
0
 
LVL 1

Author Comment

by:dcrudo
ID: 16930723
That's exactly what I was looking for!

Thank you soo much!

Dave
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 156
How to renew a Delphi rad-studio licence? 5 77
Firemonkey android show image from resource ? 1 56
Firemonkey Tcameracomponent resultion 1 23
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question