troubleshooting Question

FireMonkey - Adding Menu Items At Run Time

Avatar of efz
efzFlag for United States of America asked on
Programming Languages-OtherDelphi
9 Comments1 Solution1900 ViewsLast Modified:
Hello Valued Experts,

For years I’ve used a few lines of code to maintain a history list at the bottom of the file menu of the last few files opened. I’m converting a Delphi program to FireMonkey and I’m discovering that the File menu’s InsertObject method causes a “List index out of bounds” error.

This is the line:


Idx1 is 4 and there are 6 items in the File menu, so it wouldn’t seem the Idx1 variable is out of bounds.

If I change the Idx1 value to 1 I don’t get the error, but neither does the newly created menu item show up on the File menu.

Experimenting, I tried using AddObject(Item) and while I don’t get the error, the menu item doesn’t appear at the bottom of the File menu either.

I’m stuck. Any insight would be greatly appreciated.

Thanks in advance.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros