Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

Creating components in run time III

Hello,

I am having a problem, I am making a test and in my test I need the hint of each edit hold a value,
when I check if the value typed is like in the hint, my hint is empty. Why? And I could notice that all my edits
are with the same value hint.

Please take a look in my code

procedure TForm1.Button2Click(Sender: TObject);
Var
  I, A : Integer;
  Ed: TwwdbEdit;
begin
  A := 10;
  For I := 0 to 10 do
  Begin
    Ed := TwwdbEdit.Create(self);
    Ed.Parent := Form1;
    Ed.Top    := A;
    Ed.Left   := 200;
    Hint      := 'A'  + IntTOStr(I);;
    ShowHint  := True;
    Name      := 'Ed' + IntTOStr(I);
    Inc(A,30)
  End;
end;


procedure TForm1.Button3Click(Sender: TObject);
Var
  I : Integer;
  A, B : String;
begin
  For I := 0 to Pred(ComponentCount) do
  Begin
    If (Components[I] is TwwDBEdit) Then
       if (Components[I] as Twwdbedit).Parent = form1 then
           Begin
             A := AnsiUpperCase(trim((Components[I] as Twwdbedit).Text));
             B := AnsiUpperCase(trim((Components[I] as Twwdbedit).hint));
             If A  <> B  Then
                Begin
                  (Components[I] as Twwdbedit).Font.Color := clRed;
                  (Components[I] as Twwdbedit).ShowHint   := True
                End
           end;
  End;
end;
ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America 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 hidrau

ASKER

thanks once again

:)))