Was this helpful?
Add and Delete Menu Operations
Add menu operations to single-line or table-field menus, or delete menu operations from table-field menus by using Menuline-Menuitem escape code to add menu operations to the single-line menu at the bottom of the window. You cannot use escape code to delete menu operations from a single-line menu.
In a Vision table-field Menu frame, you can use escape code to add or delete menu operations.
To add or delete menu operations
1. Use Form-Start escape code to add or delete rows to the menu's table field before it is displayed. For details, see How You Can Change the Menu Item Text in the Table Field.
2. If you are adding menu operations, use TableField-Menuitem escape code to specify the action that occurs when the menu item is selected. For details, see the Coding a Menu Operation for a Table-Field Menu Frame section.
3. You can also edit the form to change the number of table-field rows displayed in the window. Otherwise, Vision creates the form based on the initial number of menuitems in the table (the number of called frames). For example, if you add one menu item to a table field with five called frames, the form created by Vision has five rows. You must scroll the table field to view the new sixth menu item. To display all six menu items, edit the form to display six rows.
How You Can Change the Menu Item Text in the Table Field
When a user selects a table-field Menu frame, Vision loads a table field with the menu item text for each child frame. Each row contains a Command field and an Explanation field. Use Form-Start escape code to add or delete rows in this table field before it is displayed.
For example, to display a message, use the following Form-Start escape code:
loadtable iitf
(command = 'Message', explanation = 'Display message');
For example, to remove the first menu item in the table, use the following Form-Start escape code:
deleterow iitf[1]
How You Can Code a Menu Operation for a Table-Field Menu Frame
Use Tablefield-Menuitem escape code to tell Vision what to do when the user selects a menu item that you have added in the Form-Start code.
Vision uses two 4GL local variables to handle menu operations:
iichoice represents the current row in the table field at the time the user chooses Select
iifound is an integer variable whose value is determined as follows:
If the user selects a menu item to call a child frame, then Vision sets iifound to 1 (true).
If the user selects a menu item for an operation that you have added, then Vision sets iifound to 0 (false).
If iifound is 0, Vision displays an error message that the command is not found.
Your Tablefield-Menuitem escape code must indicate what to do when the user selects a menu item that you have added in the Form-Start code (that is, when iifound is 0). If you have added more than one menu item, your Tablefield-Menuitem code must use the value of iichoice to determine which operation to execute.
Be sure to reset iifound to 1 at the end of the Tablefield-Menuitem code. Otherwise, Vision gives an error message.
For example:
if iichoice = 'message' then
message 'you have chosen the ''message'' command.'
with style = popup;
iifound = 1;
endif
Last modified date: 04/03/2024