A menu has a few global attributes, and then each menu entry has many button-like attributes that describe its appearance and behavior. Table 27-5 specifies the attributes that apply globally to the menu, unless overridden by a per-entry attribute. The table uses the X resource names, which may have a capital at interior word boundaries. In Tcl commands, use all lowercase and a leading dash.
activeBackground | Background color when the mouse is over a menu entry. |
activeForeground | Text color when the mouse is over a menu entry. |
activeBorderWidth | Width of the raised border around active entries. |
background | The normal background color for menu entries. |
borderWidth | Width of the border around all the menu entries. |
cursor | Cursor to display when mouse is over the menu. |
disabledForeground | Foreground (text) color when menu entries are disabled. |
font | Default font for the text. |
foreground | Foreground color. (Also fg). |
postCommand | Tcl command to run just before the menu is posted. |
selectColor | Color for selector in check and radio type entries. |
takeFocus | Control focus changes from keyboard traversal. |
tearOff | True if menu should contain a tear-off entry. |
tearOffCommand | Command to execute when menu is torn off. Two arguments are added: the original menu and the new tear-off. |
type | (Read-only) normal, menubar, or tearoff. (Tk 8.0). |
Table 27-6 describes the attributes for menu entries, as you would use them in a Tcl command (i.e., all lowercase with a leading dash.) The attributes for menu entries are not supported directly by the resource database. However, Example 28-6 on page 411 describes how you can use the resource database for menu entries.
-activebackground | Background color when the mouse is over the entry. |
-activeforeground | Foreground (text) color with mouse is over the entry. |
-accelerator | Text to display as a reminder about keystroke binding. |
-background | The normal background color. |
-bitmap | A bitmap to display instead of text. |
-columnbreak | Puts the entry at the start of a new column. (Tk 8.0). |
-command | Tcl command to invoke when entry is invoked. |
-font | Default font for the text. |
-foreground | Foreground color. (Also fg). |
-hidemargin | Suppresses the margin reserved for button indicators. (Tk 8.0). |
-image | Image to display instead of text or bitmap. |
-label | Text to display in the menu entry. |
-justify | Text justification: center, left, or right. |
-menu | Menu posted when cascade entry is invoked. |
-offvalue | Variable value when check entry is not selected. |
-onvalue | Value for Tcl variable when check entry is selected. |
-selectcolor | Color for selector: check and radio entries. |
-state | The state: normal, active, or disabled |
-underline | Index of text character to underline. |
-value | Value for Tcl variable when radiobutton entry is selected. |
-variable | Tcl variable associated with the check or radio entry. |
18.117.96.26