By Daniel Wood, 19 February 2011
When FileMaker 11 was released, one of the lesser documented changes in behavior concerned the defining of menu names when dealing with Custom Menus. When any menu element has an empty name, an interesting thing happens:
Well, when an item has no name, the item disappears entirely from the custom menu, and from any custom menu it may appear in. Why is this so significant you ask?
Well for starters, this was not the behavior in FileMaker 10. In 10, any menu item with no name would still appear in the list as an item with no name (funny that).
Have a look at the custom menu set above. There is a menu in this which has no name, can you see it?
Here it is, did you find it? Well done! Ahem, so anyway, as you can see the menu is still there and still selectable.
Now lets see what happens when the same custom menu is viewed in FileMaker 11:
As you can now see, the menu is entirely gone in 11, it cannot be selected at all.
After having a rummage through the FileMaker 11 documentation of new features, I could only find the following mention here:
Users can no longer remove the item title and action checkboxes dynamically when the menu item is not based on a command. This means that it is possible to have a menu item have no item name or action.
I don't really understand the first part, but the last sentence would indicate that they acknowledge the lack of menu item name as a change.
The potential to make use of this feature is limited only by your imagination. This is because menus and commands that are used in custom menus can have their name defined via calculation.
Have a look at the custom menu above. The Giraffe menu actually has its name defined in a global field in the solution, and the menu name is derived from that global:
So, whatever I enter into the global field is what the menu name is. If I remove the contents of the global entirely, the menu will disappear as it will no longer have a name.
Basically any component of a custom menu can have its name defined via calculation. Consider the following example:
The Giraffe menu contains both a command, and a sub-menu with further commands in it.
Here, I have removed the Lion commands name using the same global method. The Lion command no longer exists within the Giraffe menu.
Note:The Lion command has actually been removed from the Giraffe menu, and every other location it is used in the custom menu set, or any other custom menu set it is used in. The item either has a name or doesn't, and if it doesn't, it's gone everywhere.
Now having said that, given you are able to define an item name via calculation, you can build a calculation that will give the menu item a name under certain circumstances for example: based on your privilege set, layout you are on, flags defined in fields, global variable contents, etc. It may not disappear everywhere depending on how you build your calculation.
A sub-menu is simply a menu that is used within another menu. When this is done, the sub-menu expands to reveal its menu items contained within it.
Again, sub-menus when defined can have their name set via calculation, after all, sub-menus are simply menus.
Here I have the menu name in a global.
One thing to be aware of if trying to show or hide a sub-menu is the following option you are given when using a sub-menu:
Here, I have defined a sub-menu Zebra. The Zebra menu has its name defined via calculation and the name of which is contained within a global field. Also, for this particular sub-menu definition, I have chosen to place it in the parent menu Elephant.
Pay attention to the Override Default Behaviors option. Here I have specified an overriding title for the sub-menu. You may expect in this situation that the sub-menu should appear as "MAXIMUM ZEBRA OVERDRIVE" under all circumstances, for an override should replace any default name for the Zebra menu.
This is not the case when the menus actual name is empty. In the case where the Zebra menu has no default name, the override is NOT applied, and the menu will still disappear.
This is unfortunate because the override item name would have been the perfect convenient way to keep a sub-menu in one menu, and have it hide in others.
When the Zebra menu does have a default name, the override will be applied.
As mentioned earlier, the possibilities are endless. Here at Digital Fusion, we have used this feature in some of our custom solutions as a way to introduce a Developer menu into the solutions custom menus.
Rather than create separate menu sets for developers and users, we just have a user series of menu sets. Within each menu set is a Developer menu, whose name is only defined if the logged in user is deemed to be a developer (we check the privilege set name, and the user record for verification).
The end result is the developer menu appears for us, but not for regular users.
This has saved a great amount of time because we didn't need to replicate all of the custom menus for us. It also means we can get the best of both worlds, when testing and debugging a solution, we can use the custom menus the user sees, and we can also have access to our own developer menu which contains useful debugging tools.
I would love to hear of anyone else's ideas for using this feature.
While this is a lesser documented feature of FileMaker 11 - to the point of barely being documented at all - I think it is one of the coolest features and one that has limitless applications.
... Just be sure that you are building it for solutions that use FileMaker 11, otherwise you may not get the desired effect!
Please find attached an example file. This file was used for all the screenshots in this article, and is provided to help you fully understand what is going on in this article, and to let you experiment in FileMaker with this solution.