2005. augusztus 15., hétfő
How to check which control previously had focus
Problem/Question/Abstract:
Is there any way to tell within the OnEnter handler of Control2, which other control just passed the focus to Control2?
Answer:
type
TForm1 = class(TForm)
{ ... }
public
LastControl: TComponent;
end;
procedure TForm1.Edit1OnEnter(Sender: TObject);
begin
if Assigned(LastControl) then
{ do whatever you want with the previous control }
LastControl := Sender as TComponent;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
LastControl := nil;
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése