Speeding up FMX Tab Animations Tip

Recently I received feedback on the application I am currently developing that the tab transitions are too slow. I’m not sure of a better way, but this process worked for me:

  1. Copy FMX.TabControl.pas to your project folder
  2. Update the code to set TTabControl.DefaultSlidingDuration to 0.1

The only drawback was the Woll2Woll Image Control which was built against an older version of the TabControl.pas. If you use third party components which don’t provide source code, you may have a similar problem. In my case, I removed the Woll2Woll components.

The tab transitions now perform well.

If anyone is aware of a better way, please do leave a comment.

Thanks to Mark for this useful tip:

And the following code sample for another approach:

procedure DelayedExecute(const MillisecondDelay: Integer; const AAction: TProc);
begin
  if MillisecondDelay = 0 then
    AAction()
  else
    TThread.CreateAnonymousThread(
      procedure
      begin
        Sleep(MillisecondDelay);
        TThread.Synchronize(nil, TThreadProcedure(AAction));
      end
    ).Start;
end;

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s