Changing the Menu Item's Function

Help lets you change the macro associated with a menu item. To change the macro for an item, use the following macro:

ChangeItemBinding("item_id", "new_macro")

For example, to change the macro assigned to a menu item with the ID “item_time,” you could use the following macro:

ChangeItemBinding("item_time", "ExecProgram(`clock', 0)")

In the example in the previous section, a Help file uses a check mark to indicate whether an option is set. In the following example, the InsertItem() macro is changed so the menu item changes its function when the user sets or clears the option:

InsertItem("mnu_options", "item_showindex", "Show &Index Window",
"IfThenElse(IsMark(`show_index'), `DeleteMark(`show_index');
ChangeItemBinding("item_showindex", "JumpContents(`index.hlp')")',
`SaveMark(`show_index'); 
ChangeItemBinding("item_showindex", "JumpID(`index.hlp', `sub_cont')")'), 0)