Link to home
Start Free TrialLog in
Avatar of omsec
omsec

asked on

Catch Focus of Edit

Is is possible receive some Notification when an EditBox is activated at run-time, either thru a Mouse Click of it or using the Tab Key ?
ASKER CERTIFIED SOLUTION
Avatar of zac
zac

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 rpetruni
rpetruni

I use this one for coloring active control:

procedure TForm1.FormCreate(Sender: TObject);
begin
     Screen.OnActiveControlChange:=ColorControl;
end;

procedure TForm1.ColorControl(Sender: TObject);
var
  I : Integer;
  Forma: Tform1;
begin
  for I:= 0 to Forma.ControlCount -1 do
   begin
    if (Forma.Controls[I] is TWinControl) then
    begin
      if (Forma.Controls[I] as TWinControl).Focused then
      TEdit(Forma.Components[I])as TWinControl).color:=clWindow
      else
      TEdit(Forma.Components[I]).color:=clBtnFace;
    end;
   end;
end;

Any control wich is focused is colored in clWindow...