Contents Previous Next Subchapters

Adding Items To The Tools Menu
Syntax addmenu(parentitem)
addmenu(
parentitemcall back)

Description
Adds the item specified by the character row vector item to the "Tools" menu. If the character row vector parent is "Tools", the item that is created in the "Tools" menu. Otherwise, parent must match a drag right item that was previously specified. In this case, the new item is added to the list of for the specified parent.

If a call back command is specified, the corresponding command is executed when the menu item is selected. If call back is not present, item specifies a draw right menu item that can be the parent of other menu items.

Example
The following program adds a menu drag right menu item called "Beep" to the "Tools" menu. It then adds an item called "5 times" to the "Beep" submenu. If after executing this program, you select Tools | Beep | 5 times, O-Matrix will beep five times.

clear
parent   = "Tools"
item     = "Beep"
callback = "beep;"
addmenu(parent, item)
parent    = "Beep"
item      = "5 times"
callback  = "Beep(5)"
function Beep(n) begin
     for i = 1 to n begin
          beep;
          sleep(1)
     end
end
addmenu(parent, item, callback)