]> www.wagner.pp.ru Git - oss/ck.git/blob - doc/button.n
Ck console graphics toolkit
[oss/ck.git] / doc / button.n
1 '\"
2 '\" Copyright (c) 1990-1994 The Regents of the University of California.
3 '\" Copyright (c) 1994-1995 Sun Microsystems, Inc.
4 '\" Copyright (c) 1996-1999 Christian Werner
5 '\"
6 '\" See the file "license.terms" for information on usage and redistribution
7 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8 '\" 
9 .so man.macros
10 .TH button n 8.0 Ck "Ck Built-In Commands"
11 .BS
12 '\" Note:  do not modify the .SH NAME line immediately below!
13 .SH NAME
14 button \- Create and manipulate button widgets
15 .SH SYNOPSIS
16 \fBbutton\fI \fIpathName \fR?\fIoptions\fR?
17 .SH "STANDARD OPTIONS"
18 .LP
19 .nf
20 .ta 3.8c 7.6c 11.4c
21 \fBactiveAttributes\fR  \fBattributes\fR        \fBdisabledForeground\fR        \fBtextVariable\fR
22 \fBactiveBackground\fR  \fBbackground\fR        \fBforeground\fR        \fBunderline\fR
23 \fBactiveForeground\fR  \fBdisabledAttributes\fR        \fBtakeFocus\fR \fBunderlineAttributes\fR
24 \fBanchor\fR    \fBdisabledBackground\fR        \fBtext\fR      \fBunderlineForeground\fR
25 .fi
26 .LP
27 See the ``options'' manual entry for details on the standard options.
28 .SH "WIDGET-SPECIFIC OPTIONS"
29 .ta 4c
30 .LP
31 .nf
32 Name:   \fBcommand\fR
33 Class:  \fBCommand\fR
34 Command-Line Switch:    \fB\-command\fR
35 .fi
36 .IP
37 Specifies a Tcl command to associate with the button.  This command
38 is typically invoked when mouse button 1 is pressed over the button
39 window.
40 .LP
41 .nf
42 Name:   \fBheight\fR
43 Class:  \fBHeight\fR
44 Command-Line Switch:    \fB\-height\fR
45 .fi
46 .IP
47 Specifies a desired height for the button in screen lines.
48 If this option isn't specified, the button's desired height is 1 line.
49 .LP
50 .nf
51 Name:   \fBstate\fR
52 Class:  \fBState\fR
53 Command-Line Switch:    \fB\-state\fR
54 .fi
55 .IP
56 Specifies one of three states for the button:  \fBnormal\fR, \fBactive\fR,
57 or \fBdisabled\fR.  In normal state the button is displayed using the
58 \fBforeground\fR and \fBbackground\fR options.  The active state is
59 typically used when the input focus is in the button.  In active state
60 the button is displayed using the \fBactiveAttributes\fR,
61 \fBactiveForeground\fR and \fBactiveBackground\fR options.
62 Disabled state means that the button should be insensitive:
63 the default bindings will refuse to activate the widget and will ignore
64 mouse button presses. In this state the \fBdisabledAttributes\fR,
65 \fBdisabledForeground\fR and \fBdisabledBackground\fR options
66 determine how the button is displayed.
67 .LP
68 .nf
69 Name:   \fBwidth\fR
70 Class:  \fBWidth\fR
71 Command-Line Switch:    \fB\-width\fR
72 .fi
73 .IP
74 Specifies a desired width for the button in screen columns.
75 If this option isn't specified, the button's desired width is computed
76 from the size of the text being displayed in it.
77 .BE
78
79 .SH DESCRIPTION
80 .PP
81 The \fBbutton\fR command creates a new window (given by the
82 \fIpathName\fR argument) and makes it into a button widget.
83 Additional options, described above, may be specified on the command line
84 or in the option database to configure aspects of the button such as its
85 colors, attributes, and text. The \fBbutton\fR command returns its
86 \fIpathName\fR argument.  At the time this command is invoked,
87 there must not exist a window named \fIpathName\fR, but
88 \fIpathName\fR's parent must exist.
89 .PP
90 A button is a widget that displays a textual string, bitmap or image.
91 One of the characters may optionally be underlined using the
92 \fBunderline\fR, \fBunderlineAttributes\fR, and \fBunderlineForeground\fR
93 options. It can display itself in either of three different ways, according
94 to the \fBstate\fR option.
95 When a user invokes the button (e.g. by pressing mouse button 1 with the cursor
96 over the button), then the Tcl command specified in the \fB\-command\fR
97 option is invoked.
98
99 .SH "WIDGET COMMAND"
100 .PP
101 The \fBbutton\fR command creates a new Tcl command whose
102 name is \fIpathName\fR. This command may be used to invoke various
103 operations on the widget. It has the following general form:
104 .DS C
105 \fIpathName option \fR?\fIarg arg ...\fR?
106 .DE
107 \fIOption\fR and the \fIarg\fRs
108 determine the exact behavior of the command.  The following
109 commands are possible for button widgets:
110 .TP
111 \fIpathName \fBcget\fR \fIoption\fR
112 Returns the current value of the configuration option given
113 by \fIoption\fR.
114 \fIOption\fR may have any of the values accepted by the \fBbutton\fR
115 command.
116 .TP
117 \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
118 Query or modify the configuration options of the widget.
119 If no \fIoption\fR is specified, returns a list describing all of
120 the available options for \fIpathName\fR. If \fIoption\fR is specified
121 with no \fIvalue\fR, then the command returns a list describing the
122 one named option (this list will be identical to the corresponding
123 sublist of the value returned if no \fIoption\fR is specified).  If
124 one or more \fIoption\-value\fR pairs are specified, then the command
125 modifies the given widget option(s) to have the given value(s);  in
126 this case the command returns an empty string.
127 \fIOption\fR may have any of the values accepted by the \fBbutton\fR
128 command.
129 .TP
130 \fIpathName \fBinvoke\fR
131 Invoke the Tcl command associated with the button, if there is one.
132 The return value is the return value from the Tcl command, or an
133 empty string if there is no command associated with the button.
134 This command is ignored if the button's state is \fBdisabled\fR.
135
136 .SH "DEFAULT BINDINGS"
137 .PP
138 Ck automatically creates class bindings for buttons that give them
139 the following default behavior:
140 .IP [1]
141 A button activates whenever it gets the input focus and deactivates
142 whenever it loses the input focus.
143 .IP [2]
144 If mouse button 1 is pressed over a button, the button is invoked.
145 .IP [3]
146 When a button has the input focus, the space or return key cause the
147 button to be invoked.
148 .PP
149 If the button's state is \fBdisabled\fR then none of the above
150 actions occur:  the button is completely non-responsive.
151 .PP
152 The behavior of buttons can be changed by defining new bindings for
153 individual widgets or by redefining the class bindings.
154
155 .SH KEYWORDS
156 button, widget