Solved

Tabsheet componentCount returning always Zero ?

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 135
Correct Component for Shopping Cart. 2 105
tidtcpserver connection lost handle 2 83
How to load 2 images in same column in Delphi 2 46
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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