?
Solved

Tabsheet componentCount returning always Zero ?

Posted on 2006-06-18
3
Medium Priority
?
731 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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