There are a number of operations that apply to menu entries. We have already introduced the add operation. The entryconfigure operation is similar to the configure operation for widgets. It accepts the same attribute-value pairs used when the menu entry was added. The delete operation removes a range of menu entries. The rest of the operations are used by the library scripts that implement the standard bindings for menus.
Table 30-4. Menu operations
$w activate index | Highlights the specified entry. |
$w add type ?option value? ... | Adds a new menu entry of the specified type with the given values for various attributes. |
$w cget option | Returns the value for the configuration option. |
$w clone | Makes a linked copy of the menu. This is used to implement tear-offs and menu bars. |
$w configure ?option? ?value? ... | Returns the configuration information for the menu. |
$w delete i1 ?i2? | Deletes the menu entries from index i1 to i2. |
$w entrycget index option | Returns the value of option for the specified entry. |
$w entryconfigure index ?option? ?value? ... | Queries or modifies the configuration information for the specified menu entry. |
$w index index | Returns the numerical value of index. |
$w insert type index ?option value? ... | Like add, but inserts the new entry after the specified index. |
$w invoke index | Invokes the command associated with the entry. |
$w post x y | Displays the menu at the specified coordinates. |
$w postcascade index | Displays the cascade menu from entry index. |
$w type index | Returns the type of the entry at index. |
$w unpost | Unmaps the menu. |
$w yposition index | Returns the Y coordinate of the top of the entry. |