Leave it to Firemonkey for making an experienced Delphi developer’s day frustrating.
When you change tabs on a tabcontrol, chances are you want to place focus on a component on the current tab. Well, there is no “changed event” to accomplish this. Luckily I found this code on a Russian website *.
procedure DelayedSetFocus(control: TControl);
begin
TThread.CreateAnonymousThread(
procedure
begin
TThread.Synchronize(nil,
procedure
begin
control.SetFocus;
end);
end).Start;
end;
What this code does is delays setting focus on the control until the tabcontrol tab changes to the new tab. Simple and it works.