Link to home
Start Free TrialLog in
Avatar of dcrudo
dcrudo

asked on

Tabsheet componentCount returning always Zero ?

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
Avatar of mokule
mokule
Flag of Poland image

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;

ASKER CERTIFIED SOLUTION
Avatar of TheRealLoki
TheRealLoki
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dcrudo
dcrudo

ASKER

That's exactly what I was looking for!

Thank you soo much!

Dave