Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi - Set form to not focus on any component when it shows

Tags:

delphi

Is there a way in Delphi to disallow the form to focus on any of its components but not disabling those components? I tried Self.SetFocus on FormActivate event of the form but the program says that it cannot focus on a disabled component.

like image 673
rajeemcariazo Avatar asked Jul 21 '10 06:07

rajeemcariazo


1 Answers

Use the following OnActivate event handler:

procedure TForm1.FormActivate(Sender: TObject);
begin
  ActiveControl:= nil;
end;
like image 183
kludg Avatar answered Nov 15 '22 20:11

kludg