Author: Tomas Rutkauskas
Is there any way to tell within the OnEnter handler of Control2, which other
control just passed the focus to Control2?
Answer:
1 type2 TForm1 = class(TForm)
3 { ... }4 public5 LastControl: TComponent;
6 end;
7 8 procedure TForm1.Edit1OnEnter(Sender: TObject);
9 begin10 if Assigned(LastControl) then11 { do whatever you want with the previous control }12 LastControl := Sender as TComponent;
13 end;
14 15 procedure TForm1.FormCreate(Sender: TObject);
16 begin17 LastControl := nil;
18 end;