FMX menu unfurling speed

A bit ago I posted a QC report complaining about the speed at which a nested FMX popup menu unfurls. Steps:

  1. Create a new FMX desktop application.
  2. Add a TPopupMenu to the form, then four items to the popup menu, the second parented to the first, the third to second and the fourth to the third.
  3. Add a TRectangle to the form and assign its PopupMenu property to PopupMenu1.
  4. Right click on the popup menu, select the first item then hover over the second; once the third item is shown, hover over it to show the fourth.

Expected: the menu unfolds quickly.
Actual: the menu unfolds sloooowly.

At the time I thought FMX menus were just slow… until it recently got pointed out to me that the FMX source in fact hardcodes a delay of 500ms. As such, if you require quickly unfurling menus, just take a copy of FMX.Menus.pas and change the value assigned to FDelay in the constructor for TAutopopupMenuTimer (line 575 in XE5 RTM).

That said, ideally, the correct value would be got from the OS; for Windows, the API function to call is SystemParametersInfo:


function GetMenuShowDelay: Integer;
  Value: DWORD;
  SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, @Value, 0);
  Result := Value;

To be honest, I’m not sure what the OS X equivalent (if there is one) is, so if anyone knows, feel free to tell all in the comments…


One thought on “FMX menu unfurling speed

Leave a Reply

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

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

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s