Solved

Tabsheet componentCount returning always Zero ?

Posted on 2006-06-18
3
708 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now