Editing Menu Items |
Top Previous Next |
The Edit Menu Item dialog is shown when adding or editing items from the Edit Menu Definition function. It's also used for adding or editing sub-items, from a Sub-menu item's Edit Menu Item dialog, so you could potentially be multiple levels deep into the same dialog.
Here you edit all of the components of a Menu Item. This one dialog is used for all types of items, even though different information is needed for each type. To help avoid confusion, it will only show the fields that apply to the item type that's currently chosen. Choosing a different Menu Item Type will completely change most of the fields available on the dialog.
The common fields available to all items are described first, followed by the type-specific fields for each item type.
Menu Item Type
The item type defines what will be done to the base menu -- either adding something to it (an action, separator or sub-menu) or changing something already in it (remove or rename a selection).
Execute Action -- This adds a selection to the menu, which executes an expression when the selection is clicked on.
Sub-menu -- This adds a selection which doesn't do anything itself, but opens another menu. You also define all of the selections which will be in that sub-menu.
Separator -- This just adds a line in the menu, used for separating groups of selections.
Remove selection -- This will completely remove an existing selection from the menu.
Rename selection -- This will change the name of an existing selection in the menu.
Condition Expression
All Menu Item types can have an optional condition expression. If a condition is entered, this determines whether the item is processed, e.g. whether the selection is added or not, or whether the selection is removed/renamed or not. It doesn't just disable the item (that's done by access level -- see below).
The condition expression must return a True or False boolean value. If used for a sub-menu, it naturally affects all sub-items too (the entire sub-menu is only added if the condition is True). To edit the condition expression, click on the text box or click the Edit button next to it. The Expression Creator dialog will be used to enter the expression.
Notes
You can add Notes to any item to help clarify its use. The notes will only show up in the list of menu items (the user will never see the notes).
Execute Action Items
Action Items are the main part of a menu -- the selections that actually do something useful. Anything you see in a menu that's not a sub-menu or separator is an "Action" item, whether it does something immediately (e.g. Save the database file) or opens a dialog prompting for more information (e.g. Log In).
Access Level
Select the lowest access level that should be able to do this action. If the current operator does not have this level or higher, the selection will still be in the menu but it will be disabled (greyed out).
Menu Item Selection Name
This is the text that will appear for the action item in the menu. You can either enter static (non-changing) text, like "Delete reservation", or you can create an expression such that the menu text will change depending on the situation or the record in question (e.g. "Extend by 1 month (to April 30)" ).
You need to select which way you want to enter the selection name (click one of the radio buttons), and then the appropriate entry field will be shown. If it's static text, then just enter it in the Selection Name field. If you choose to enter it as an expression, the Selection Name box will be greyed out -- to edit the condition expression, just click on the greyed-out box or click the Edit button next to it. The Expression Creator dialog will be used to enter the expression.
Underlining Hot-key letters
You can specify which letter is underlined, to be used as a hot-key for the menu selection, by inserting an ampersand ("&") in the text. For instance if you enter "Delete re&servation", the "s" will be underlined and will be the hot-key, and it will be shown as "Delete reservation". Then in the resulting menu you can just press "s" on the keyboard instead of using the mouse to click on the selection in the menu.
Be careful about underlining a letter that's already used as a hot-key. If there's more than one selection in the same menu that uses the same hot-key letter, pressing that key will only move to that selection (highlight it) -- it won't execute it. Pressing the key again would move to the next one with that hot-key, etc.
Note: If you actually want to show "&" in the menu, like "This & That", then you need to use two of them in the selection text: "This && That". This tells Windows that you want to show the & instead of underline the next letter.
Important: There's an option in Windows XP to hide the underlines until you press the Alt-key, and in Microsoft's wisdom they seem to have enabled that option by default in some cases (why confuse the user with all those underlines, right?). So if you don't see any letters underlined in the menu, just press the Alt key and the underlines should show up (this applies to all menu selections, not just the ones you add). You can also disable this option in XP by going into Desktop Properties (right-click on an empty desktop area), click the "Appearance" tab, click the "Effects" button, and uncheck the "Hide underlined letters" option.
Action Expression
This defines what will actually happen when the menu item is selected. Simply put, this expression is executed when the item is clicked. The result of the expression is not used, so it doesn't have to return any particular type of value. To edit the action expression, click on the text box or click the Edit button next to it. The Expression Creator dialog will be used to enter the expression.
Naturally the expression should "do" something useful. Many useful functions are available to do things like show a message, open Queries, send E-mail, print Forms, open Dialogs, or even just execute another menu command. To browse some of the possible actions, select the "User interaction" function type (through Insert Expression Element, in the Expression Creator dialog).
Of course it doesn't necessarily have to do anything visible -- for instance you can just set a field value. But we recommend that you always show some indication that the action was performed, e.g. with a MessageBox( ) confirming the action and perhaps showing the details or results, so the operator knows that something actually happened and that they clicked the right thing.
If you do anything complex, e.g. more than one function, then it may be a good idea to create a Script for it and then just use CallScript( ) to call the Script from the Action expression here.
Note that for right-click menu items, there may be context information available -- for instance the This() function may give the reservation, site or transaction that was clicked on, and for the Rack there will be ThisDate() and ThisPeriod() context.
Sub-Menu Items
A sub-menu is used to organize menu functions in logical groups, and to keep each level of a complex menu from getting too long. A sub-menu will have a name in the menu just like an action item, but clicking on it will simply open another menu (usually to the right of the sub-menu item, if there's room for it there). A right-arrow indicator will be added to the right edge of the menu automatically (by Windows), to indicate that it will open another menu.
A sub-menu item needs a Selection Name to be shown in the menu, which is described above for Execute Action items (see "Menu Item Selection Name" above).
A sub-menu also needs Menu Items of its own, so a list of Menu Items will be shown here with applicable editing commends, just like the Edit Menu Item dialog. See the previous section about the Menu Items List for details.
Separator Items
A separator is just a line in the menu used for organizing selections into groups, so there's no more information needed for a separator.
Remove Selection / Rename Selection Items
These item types are used for modifying existing selections in a menu. Generally this is done for standard selections that the program includes, but it's also possible to do it for selections that you've add yourself (though it's better to handle this with the Condition or Selection Name expression of the original Menu Item definition).
If it's a Rename Selection item, it needs a new Selection Name that the original menu selection will be renamed to. This field is described above for Execute Action items (see "Menu Item Selection Name" above).
Finding the Item to remove/rename
For both Rename and Remove selection items, it needs to know which item to act on. You can have it find the item by name or by its internal ID/command, so first select which way you'll find it.
Whenever possible, e.g. whenever it's for a standard menu command, choose the ID/Command option and select the appropriate command form the list. The list shows all menus in the system that can be modified, with all sub-menu command items. Note that the "ID to remove" will be shown for the selected item, but only for reference -- it cannot be modified directly.
Tip: You can use this to find out the command ID of a menu item, for instance if you want to execute the command through the expression function MenuCommand( ).
While you could choose to find the item by name, that might not always work -- sometimes a selection's name is changed based on the condition (e.g. "Check out" vs. "Undo check-out"), and it's also possible that the menu selection name may change in future versions of the software (but the command ID should never change).
There are some cases where you do need to find it by name. If it's an item you added through a Menu Definition yourself, the ID is not known at this time so the name must be entered. Also, sub-menu names don't have an ID, so they would have to be located by name. For instance if you wanted to rename the "Park Setup" sub-menu selection under Maintenance, you would have to find it by name.
Note that in either case, the "search" for the selection is recursive -- it will look at all levels of sub-menus below the base menu of the Menu Definition until it locates the selection to be renamed or removed. Of course if it doesn't find a match, then nothing happens.
Important: When searching by name, any ampersand characters ("&") in the menu selection will be ignored. For instance if the original menu selection name is "&File" so that it's shown as "File" in the menu, you should only enter "File" in the text to search for.
Additional Topics:
Advanced Customizations Overview & other topics