In the layout setup there is an option for the Menu Set to use.
Layouts > Layout Setup
To make assigning them easier, go to Manage Layouts and access the layout setup from there also.
Oh, ok. I guess my issue is that I want to assign different menu sets by calculation. Looks like this won't work here.
If what you're trying to do is have the menu set change according to the activity taking place, then it seems to me making it part of a script that's involved in the activity or by script trigger already IS an elegant way to go. I tend to assign a menu set per layout and make sure to pass on a parameter to the script rather than hard coding. This makes the menu items much more portable. The problem with menu items is that unless you're efficient with them it's easy to end up with hundreds. Example: instead of a script parameter like GetField("your table:: field") use GetField(Get(LayoutTableName)&":: field") and the same script can be used in multiple contexts. . . . hope I remembered the correct syntax . . .
You probably know all this . . .
So what I want to do is to set a menu set according to privilege set and have that be the same for every layout for that user.
What you're describing is what I started to set up, but thought I'd see if there is a better way to do it. Not too difficult, so I'll continue down that path.
That sounds quite possible. I've never done it, but it seems you could Get the privilege set in an opening script and pass it on as a parameter to a script (OnLayoutLoad) that assigns the menu set. Then using OnLayoutLoad as a trigger, do the same thing for the remaining layouts. It wouldn't exactly be "by calculation" but unless you have an unusually large number of privilege sets it seems it could be done without too much trouble. Also I assume not every privilege set will have access to every layout so it could be even less work once you've set up layout access.
If I am correct in thinking (since ive not actually done this)
You would only have to get the privelages and set the menu once on startup, not for each layout.
Leave the all the layouts as 'default' menu
Then in your start up script, when setting the script step to install the corresponding menu based on privileges, also choose the option use as file default.
Hopefully, any layout where 'default' is set should then proceed to use the new 'installed menu' in place of the default.
I'll give it a try again. I thought it would function like this, but it would revert to the full menu set when I changed layouts; this is the first time I've worked with installing menu sets. Thanks for the help.
Other options to consider (and you may already have).
Restrict your menu set options in access privileges for each privilege set. This may not give you the precise set of options you want, but if you can set it up here, it's much simpler than custom menu sets.
Write "smart scripts" or a single custom menu that uses Get ( PrivilegeSetName ) to determine what happens if the user selects that menu option.