I have a menu that I’ve duped and modified for two different window presentation models. On one window, the main menu enables all menu entries with no prompting from me. On the second window, one of the menu options is not enabled.
The menuitem names are the same, the Menu Handlers are the same and autocomplete doesn’t show collisions, and the compile is successful. I even changed the text of one to make sure that the menus are being swapped. The other items in the remaining menus enable and work as expected.
Next, I changed the name of the menuitem under the secondary menu, added it’s name to the EnableMenuItems event and was promptly informed that the new menuitem did not exist.
Is there clear documentation somewhere that discusses the steps required to maintain 4 principle menus - 2 for macOS (one for each window presentation) and a duplicate 2 for Windows and Linux?
The menus that act up all have the large negative “Index” value. The ones that work are all simply “1”.
However, other menus that work have that same “-2147483648” value …
Oops- I got that backwards - the menus with that value are the ones that work. The menus with any other index value are the ones I’m having the problems with. This might explain why deleting the menuitem and then recreating it solved it before.
I fully understand the usefulness of the Index and menu arrays, but I’ve finaly discovered HOW it happens in my case.
When I create a menu that I know what is going to be included, I have already mapped it out on paper. Therefore, I just add the menu and all of its subs at one time, returning to each to populate its properties after the templates are added. This causes a slew of “Unnamed” menuitems and an unrecognized bunch of Index assignments. Back in the REAL.Studio days, I seem to recall that this method created menuitems with names like “Unnamed”, “Unnamed1”, “Unnamed2”, etc. and I didn’t run into this Index issue.
I’ll pay closer attention when I do these bulk additions in the future and clear the Index values where they are not needed.