|
|
- (#<widget> 'add type ?option value option value ...?)
- Add a new entry to the bottom of the menu. The new entry's type is given by type and must be one of cascade, checkbutton, command, radiobutton, or separator, or a unique abbreviation of one of the above.
If additional arguments are present, they specify any of the following options:
- #:activebackground value
- Specifies a background color to use for displaying this entry when it is active. If this option is specified as an empty string (the default), then the activeBackground option for the overall menu is used. If the tk_strictMotif variable has been set to request strict Motif compliance, then this option is ignored and the #:background option is used in its place. This option is not available for separator or tear-off entries.
- #:activeforeground value
- Specifies a foreground color to use for displaying this entry when it is active. If this option is specified as an empty string (the default), then the activeForeground option for the overall menu is used. This option is not available for separator or tear-off entries.
- #:accelerator value
- Specifies a string to display at the right side of the menu entry. Normally describes an accelerator keystroke sequence that may be typed to invoke the same function as the menu entry. This option is not available for separator or tear-off entries.
- #:background value
- Specifies a background color to use for displaying this entry when it is in the normal state (neither active nor disabled). If this option is specified as an empty string (the default), then the background option for the overall menu is used. This option is not available for separator or tear-off entries.
- #:bitmap value
- Specifies a bitmap to display in the menu instead of a textual label, in any of the forms accepted by Tk_GetBitmap. This option overrides the #:label option but may be reset to an empty string to enable a textual label to be displayed. If a #:image option has been specified, it overrides #:bitmap. This option is not available for separator or tear-off entries.
- #:columnbreak value
- When this option is zero, the appears below the previous entry. When this option is one, the menu appears at the top of a new column in the menu.
- #:command value
- Specifies a Tcl command to execute when the menu entry is invoked. Not available for separator or tear-off entries.
- #:compound value
- Specifies whether the menu entry should display both an image and text, and if so, where the image should be placed relative to the text. Valid values for this option are bottom, center, left, none, right and top. The default value is none, meaning that the button will display either an image or text, depending on the values of the #:image and #:bitmap options.
- #:font value
- Specifies the font to use when drawing the label or accelerator string in this entry. If this option is specified as an empty string (the default) then the font option for the overall menu is used. This option is not available for separator or tear-off entries.
- #:foreground value
- Specifies a foreground color to use for displaying this entry when it is in the normal state (neither active nor disabled). If this option is specified as an empty string (the default), then the foreground option for the overall menu is used. This option is not available for separator or tear-off entries.
- #:hidemargin value
- Specifies whether the standard margins should be drawn for this menu entry. This is useful when creating palette with images in them, i.e., color palettes, pattern palettes, etc. 1 indicates that the margin for the entry is hidden; 0 means that the margin is used.
- #:image value
- Specifies an image to display in the menu instead of a text string or bitmap The image must have been created by some previous invocation of image create. This option overrides the #:label and #:bitmap options but may be reset to an empty string to enable a textual or bitmap label to be displayed. This option is not available for separator or tear-off entries.
- #:indicatoron value
- Available only for checkbutton and radiobutton entries. Value is a boolean that determines whether or not the indicator should be displayed.
- #:label value
- Specifies a string to display as an identifying label in the menu entry. Not available for separator or tear-off entries.
- #:menu value
- Available only for cascade entries. Specifies the path name of the submenu associated with this entry. The submenu must be a child of the menu.
- #:offvalue valueAvailable only for checkbutton entries. Specifies the value to store in the entry's associated variable when the entry is deselected.
- #:onvalue value
- Available only for checkbutton entries. Specifies the value to store in the entry's associated variable when the entry is selected.
- #:selectcolor value
- Available only for checkbutton and radiobutton entries. Specifies the color to display in the indicator when the entry is selected. If the value is an empty string (the default) then the selectColor option for the menu determines the indicator color.
- #:selectimage value
- Available only for checkbutton and radiobutton entries. Specifies an image to display in the entry (in place of the #:image option) when it is selected. Value is the name of an image, which must have been created by some previous invocation of image create. This option is ignored unless the #:image option has been specified.
- #:state value
- Specifies one of three states for the entry: normal, active, or disabled. In normal state the entry is displayed using the foreground option for the menu and the background option from the entry or the menu. The active state is typically used when the pointer is over the entry. In active state the entry is displayed using the activeForeground option for the menu along with the activebackground option from the entry. Disabled state means that the entry should be insensitive: the default bindings will refuse to activate or invoke the entry. In this state the entry is displayed according to the disabledForeground option for the menu and the background option from the entry. This option is not available for separator entries.
- #:underline value
- Specifies the integer index of a character to underline in the entry. This option is also queried by the default bindings and used to implement keyboard traversal. 0 corresponds to the first character of the text displayed in the entry, 1 to the next character, and so on. If a bitmap or image is displayed in the entry then this option is ignored. This option is not available for separator or tear-off entries.
- #:value value
- Available only for radiobutton entries. Specifies the value to store in the entry's associated variable when the entry is selected. If an empty string is specified, then the #:label option for the entry as the value to store in the variable.
- #:variable value
- Available only for checkbutton and radiobutton entries. Specifies the name of a global value to set when the entry is selected. For checkbutton entries the variable is also set when the entry is deselected. For radiobutton entries, changing the variable causes the currently-selected entry to deselect itself.
The add widget command returns an empty string.
© Author
| Home
| Sitemap
|