~ubuntu-branches/ubuntu/dapper/tk8.0/dapper-updates

« back to all changes in this revision

Viewing changes to doc/menubutton.n

  • Committer: Bazaar Package Importer
  • Author(s): Mike Markley
  • Date: 2001-07-24 21:57:40 UTC
  • Revision ID: james.westby@ubuntu.com-20010724215740-r70t25rtmbqjil2h
Tags: upstream-8.0.5
ImportĀ upstreamĀ versionĀ 8.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\"
 
2
'\" Copyright (c) 1990-1994 The Regents of the University of California.
 
3
'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.
 
4
'\"
 
5
'\" See the file "license.terms" for information on usage and redistribution
 
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
7
'\" 
 
8
'\" RCS: @(#) $Id: menubutton.n,v 1.2 1998/09/14 18:22:57 stanton Exp $
 
9
'\" 
 
10
.so man.macros
 
11
.TH menubutton n 4.0 Tk "Tk Built-In Commands"
 
12
.BS
 
13
'\" Note:  do not modify the .SH NAME line immediately below!
 
14
.SH NAME
 
15
menubutton \- Create and manipulate menubutton widgets
 
16
.SH SYNOPSIS
 
17
\fBmenubutton\fR \fIpathName \fR?\fIoptions\fR?
 
18
.SO
 
19
\-activebackground      \-cursor        \-highlightthickness    \-takefocus
 
20
\-activeforeground      \-disabledforeground    \-image \-text
 
21
\-anchor        \-font  \-justify       \-textvariable
 
22
\-background    \-foreground    \-padx  \-underline
 
23
\-bitmap        \-highlightbackground   \-pady  \-wraplength
 
24
\-borderwidth   \-highlightcolor        \-relief
 
25
.SE
 
26
.SH "WIDGET-SPECIFIC OPTIONS"
 
27
.VS
 
28
.OP \-direction direction Height
 
29
Specifies where the menu is going to be popup up. \fBabove\fR tries to
 
30
pop the menu above the menubutton. \fBbelow\fR tries to pop the menu
 
31
below the menubutton. \fBleft\fR tries to pop the menu to the left of
 
32
the menubutton. \fBright\fR tries to pop the menu to the right of the
 
33
menu button. \fBflush\fR pops the menu directly over the menubutton.
 
34
.VE
 
35
.OP \-height height Height
 
36
Specifies a desired height for the menubutton.
 
37
If an image or bitmap is being displayed in the menubutton then the value is in
 
38
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
 
39
for text it is in lines of text.
 
40
If this option isn't specified, the menubutton's desired height is computed
 
41
from the size of the image or bitmap or text being displayed in it.
 
42
.OP \-indicatoron indicatorOn IndicatorOn
 
43
The value must be a proper boolean value.  If it is true then
 
44
a small indicator rectangle will be displayed on the right side
 
45
of the menubutton and the default menu bindings will treat this
 
46
as an option menubutton.  If false then no indicator will be
 
47
displayed.
 
48
.OP \-menu menu MenuName
 
49
Specifies the path name of the menu associated with this menubutton.
 
50
The menu must be a child of the menubutton.
 
51
.OP \-state state State
 
52
Specifies one of three states for the menubutton:  \fBnormal\fR, \fBactive\fR,
 
53
or \fBdisabled\fR.  In normal state the menubutton is displayed using the
 
54
\fBforeground\fR and \fBbackground\fR options.  The active state is
 
55
typically used when the pointer is over the menubutton.  In active state
 
56
the menubutton is displayed using the \fBactiveForeground\fR and
 
57
\fBactiveBackground\fR options.  Disabled state means that the menubutton
 
58
should be insensitive:  the default bindings will refuse to activate
 
59
the widget and will ignore mouse button presses.
 
60
In this state the \fBdisabledForeground\fR and
 
61
\fBbackground\fR options determine how the button is displayed.
 
62
.OP \-width width Width
 
63
Specifies a desired width for the menubutton.
 
64
If an image or bitmap is being displayed in the menubutton then the value is in
 
65
screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
 
66
for text it is in characters.
 
67
If this option isn't specified, the menubutton's desired width is computed
 
68
from the size of the image or bitmap or text being displayed in it.
 
69
.BE
 
70
 
 
71
.SH INTRODUCTION
 
72
.PP
 
73
The \fBmenubutton\fR command creates a new window (given by the
 
74
\fIpathName\fR argument) and makes it into a menubutton widget.
 
75
Additional
 
76
options, described above, may be specified on the command line
 
77
or in the option database
 
78
to configure aspects of the menubutton such as its colors, font,
 
79
text, and initial relief.  The \fBmenubutton\fR command returns its
 
80
\fIpathName\fR argument.  At the time this command is invoked,
 
81
there must not exist a window named \fIpathName\fR, but
 
82
\fIpathName\fR's parent must exist.
 
83
.PP
 
84
A menubutton is a widget that displays a textual string, bitmap, or image
 
85
and is associated with a menu widget.
 
86
If text is displayed, it must all be in a single font, but it
 
87
can occupy multiple lines on the screen (if it contains newlines
 
88
or if wrapping occurs because of the \fBwrapLength\fR option) and
 
89
one of the characters may optionally be underlined using the
 
90
\fBunderline\fR option.  In normal usage, pressing
 
91
mouse button 1 over the menubutton causes the associated menu to
 
92
be posted just underneath the menubutton.  If the mouse is moved over
 
93
the menu before releasing the mouse button, the button release
 
94
causes the underlying menu entry to be invoked.  When the button
 
95
is released, the menu is unposted.
 
96
.PP
 
97
Menubuttons are typically organized into groups called menu bars
 
98
that allow scanning:
 
99
if the mouse button is pressed over one menubutton (causing it
 
100
to post its menu) and the mouse is moved over another menubutton
 
101
in the same menu bar without releasing the mouse button, then the
 
102
menu of the first menubutton is unposted and the menu of the
 
103
new menubutton is posted instead.
 
104
.PP
 
105
There are several interactions between menubuttons and menus;  see
 
106
the \fBmenu\fR manual entry for information on various menu configurations,
 
107
such as pulldown menus and option menus.
 
108
 
 
109
.SH "WIDGET COMMAND"
 
110
.PP
 
111
The \fBmenubutton\fR command creates a new Tcl command whose
 
112
name is \fIpathName\fR.  This
 
113
command may be used to invoke various
 
114
operations on the widget.  It has the following general form:
 
115
.CS
 
116
\fIpathName option \fR?\fIarg arg ...\fR?
 
117
.CE
 
118
\fIOption\fR and the \fIarg\fRs
 
119
determine the exact behavior of the command.  The following
 
120
commands are possible for menubutton widgets:
 
121
.TP
 
122
\fIpathName \fBcget\fR \fIoption\fR
 
123
Returns the current value of the configuration option given
 
124
by \fIoption\fR.
 
125
\fIOption\fR may have any of the values accepted by the \fBmenubutton\fR
 
126
command.
 
127
.TP
 
128
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
 
129
Query or modify the configuration options of the widget.
 
130
If no \fIoption\fR is specified, returns a list describing all of
 
131
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
 
132
information on the format of this list).  If \fIoption\fR is specified
 
133
with no \fIvalue\fR, then the command returns a list describing the
 
134
one named option (this list will be identical to the corresponding
 
135
sublist of the value returned if no \fIoption\fR is specified).  If
 
136
one or more \fIoption\-value\fR pairs are specified, then the command
 
137
modifies the given widget option(s) to have the given value(s);  in
 
138
this case the command returns an empty string.
 
139
\fIOption\fR may have any of the values accepted by the \fBmenubutton\fR
 
140
command.
 
141
 
 
142
.SH "DEFAULT BINDINGS"
 
143
.PP
 
144
Tk automatically creates class bindings for menubuttons that give them
 
145
the following default behavior:
 
146
.IP [1]
 
147
A menubutton activates whenever the mouse passes over it and deactivates
 
148
whenever the mouse leaves it.
 
149
.IP [2]
 
150
Pressing mouse button 1 over a menubutton posts the menubutton:
 
151
its relief changes to raised and its associated menu is posted
 
152
under the menubutton.  If the mouse is dragged down into the menu
 
153
with the button still down, and if the mouse button is then
 
154
released over an entry in the menu, the menubutton is unposted
 
155
and the menu entry is invoked.
 
156
.IP [3]
 
157
If button 1 is pressed over a menubutton and then released over that
 
158
menubutton, the menubutton stays posted: you can still move the mouse
 
159
over the menu and click button 1 on an entry to invoke it.
 
160
Once a menu entry has been invoked, the menubutton unposts itself.
 
161
.IP [4]
 
162
If button 1 is pressed over a menubutton and then dragged over some
 
163
other menubutton, the original menubutton unposts itself and the
 
164
new menubutton posts.
 
165
.IP [5]
 
166
If button 1 is pressed over a menubutton and released outside
 
167
any menubutton or menu, the menubutton unposts without invoking
 
168
any menu entry.
 
169
.IP [6]
 
170
When a menubutton is posted, its associated menu claims the input
 
171
focus to allow keyboard traversal of the menu and its submenus.
 
172
See the \fBmenu\fR manual entry for details on these bindings.
 
173
.IP [7]
 
174
If the \fBunderline\fR option has been specified for a menubutton
 
175
then keyboard traversal may be used to post the menubutton:
 
176
Alt+\fIx\fR, where \fIx\fR is the underlined character (or its
 
177
lower-case or upper-case equivalent), may be typed in any window
 
178
under the menubutton's toplevel to post the menubutton.
 
179
.IP [8]
 
180
The F10 key may be typed in any window to post the first menubutton
 
181
under its toplevel window that isn't disabled.
 
182
.IP [9]
 
183
If a menubutton has the input focus, the space and return keys
 
184
post the menubutton.
 
185
.PP
 
186
If the menubutton's state is \fBdisabled\fR then none of the above
 
187
actions occur:  the menubutton is completely non-responsive.
 
188
.PP
 
189
The behavior of menubuttons can be changed by defining new bindings for
 
190
individual widgets or by redefining the class bindings.
 
191
 
 
192
.SH KEYWORDS
 
193
menubutton, widget