Debian Codegraph @

man/busy.mann

raw
1 '\"
2 '\" Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies.
3 '\"
4 '\" Permission to use, copy, modify, and distribute this software and its
5 '\" documentation for any purpose and without fee is hereby granted, provided
6 '\" that the above copyright notice appear in all copies and that both that the
7 '\" copyright notice and warranty disclaimer appear in supporting documentation,
8 '\" and that the names of Lucent Technologies any of their entities not be used
9 '\" in advertising or publicity pertaining to distribution of the software
10 '\" without specific, written prior permission.
11 '\"
12 '\" Lucent Technologies disclaims all warranties with regard to this software,
13 '\" including all implied warranties of merchantability and fitness. In no event
14 '\" shall Lucent Technologies be liable for any special, indirect or
15 '\" consequential damages or any damages whatsoever resulting from loss of use,
16 '\" data or profits, whether in an action of contract, negligence or other
17 '\" tortuous action, arising out of or in connection with the use or performance
18 '\" of this software.
19 '\"
20 '\" Busy command created by George Howlett.
21 '\"
22 .so man.macros
23 .TH busy n BLT_VERSION BLT "BLT Built-In Commands"
24 .BS
25 '\" Note: do not modify the .SH NAME line immediately below!
26 .SH NAME
27 busy \- Make Tk widgets busy, temporarily blocking user interactions.
28 .SH SYNOPSIS
29 \fBbusy hold \fIwindow\fR ?\fIoption value\fR?...
30 .sp
31 \fBbusy release \fIwindow\fR ?\fIwindow\fR?...
32 .sp
33 \fBbusy configure \fIwindow\fR ?\fIoption value\fR?...
34 .sp
35 \fBbusy forget \fIwindow\fR ?\fIwindow\fR?...
36 .sp
37 \fBbusy isbusy \fR?\fIpattern\fR?
38 .sp
39 \fBbusy names \fR?\fIpattern\fR?
40 .sp
41 \fBbusy status \fIwindow\fR
42 .BE
43 .SH DESCRIPTION
44 .PP
45 The \fBbusy\fR command provides a simple means to block
46 keyboard, button, and pointer events from Tk widgets, while overriding
47 the widget's cursor with a configurable busy cursor.
48 .SH INTRODUCTION
49 .PP
50 There are many times in applications where you want to temporarily
51 restrict what actions the user can take. For example, an application
52 could have a "run" button that when pressed causes some processing to
53 occur. But while the application is busy processing, you probably don't
54 want the the user to be able to click the "run" button again. You
55 may also want restrict the user from other tasks such as clicking a
56 "print" button.
57 .PP
58 The \fBbusy\fR command lets you make Tk widgets busy. This means
59 that user interactions such as button clicks, moving the mouse, typing
60 at the keyboard, etc. are ignored by the widget. You can set a
61 special cursor (like a watch) that overrides the widget's normal
62 cursor, providing feedback that the application (widget) is
63 temporarily busy.
64 .PP
65 When a widget is made busy, the widget and all of its descendents will
66 ignore events. It's easy to make an entire panel of widgets busy. You
67 can simply make the toplevel widget (such as ".") busy. This is
68 easier and far much more efficient than recursively traversing the
69 widget hierarchy, disabling each widget and re-configuring its cursor.
70 .PP
71 Often, the busy command can be used instead of Tk's \fBgrab\fR
72 command. Unlike \fBgrab\fR which restricts all user interactions to
73 one widget, with the busy command you can have more than one widget
74 active (for example, a "cancel" dialog and a "help" button).
75 .SH EXAMPLE
76 You can make several widgets busy by simply making its ancestor widget
77 busy using the \fBhold\fR operation.
78 .CS
79 frame .top
80 button .top.button; canvas .top.canvas
81 pack .top.button .top.canvas
82 pack .top
83 . . .
84 busy hold .top
85 update
86 .CE
87 All the widgets within \fB.top\fR (including \fB.top\fR) are now busy.
88 Using \fBupdate\fR insures that \fBbusy\fR command will take effect before
89 any other user events can occur.
90 .PP
91 When the application is no longer busy processing, you can allow user
92 interactions again by the \fBrelease\fR operation.
93 .nf
94
95 \fB busy release .top \fR
96
97 .fi
98 The busy window has a configurable cursor. You can change the busy
99 cursor using the \fBconfigure\fR operation.
100 .nf
101
102 \fB busy configure .top -cursor "watch"\fR
103
104 .fi
105 Finally, when you no longer need to the busy window,
106 invoke the \fBforget\fR operation to free any resources it allocated.
107 .nf
108
109 \fB busy forget .top \fR
110
111 .fi
112 Destroying the widget will also clean up any resources allocated by
113 the busy command.
114 .PP
115 .SH OPERATIONS
116 The following operations are available for the \fBbusy\fR command:
117 .TP
118 \fBbusy hold \fIwindow\fR ?\fIoption value\fR?...
119 Makes the widget \fIwindow\fR (and its descendants in the Tk window
120 hierarchy) busy. \fIWindow\fR must be a valid path name of a Tk
121 widget. The busy window is mapped the next time idle tasks are
122 processed, and the widget and its descendants will be blocked from
123 user interactions. All events in the widget window and its
124 descendants are ignored. Normally \fBupdate\fR should be called
125 immediately afterward to insure that the \fBhold\fR operation is in
126 effect \fIbefore\fR the application starts its processing. The
127 following configuration options are valid:
128 .RS
129 .TP
130 \fB\-cursor \fIcursorName\fR
131 Specifies the cursor to be displayed when the widget is made busy.
132 \fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR.
133 The default cursor is \fBwatch\fR.
134 .RE
135 .TP
136 \fBbusy configure \fIwindow\fR ?\fIoption value\fR?...
137 Queries or modifies the \fBbusy\fR command configuration options for
138 \fIwindow\fR. \fIWindow\fR must be the path name of a widget previously
139 made busy by the \fBhold\fR operation. If no options are
140 specified, a list describing all of the available options for
141 \fIwindow\fR (see \fBTk_ConfigureInfo\fR for information on the format
142 of this list) is returned. If \fIoption\fR is specified with no
143 \fIvalue\fR, then the command returns a list describing the one named
144 option (this list will be identical to the corresponding sublist of
145 the value returned if no \fIoption\fR is specified). If one or more
146 \fIoption\-value\fR pairs are specified, then the command modifies the
147 given widget option(s) to have the given value(s); in this case the
148 command returns the empty string. \fIOption\fR may have any of the
149 values accepted by the \fBhold\fR operation.
150 .sp
151 Please note that the
152 option database is referenced through \fIwindow\fR. For example, if
153 the widget \fB.frame\fR is to be made busy, the busy
154 cursor can be specified for it by either \fBoption\fR command:
155 .nf
156
157 \fBoption add *frame.busyCursor gumby\fR
158 \fBoption add *Frame.BusyCursor gumby\fR
159
160 .fi
161 .TP
162 \fBbusy forget \fIwindow\fR ?\fIwindow\fR?...
163 Releases resources allocated by the busy command for \fIwindow\fR,
164 including the busy window. User events will again be received again
165 by \fIwindow\fR. Resources are also released when \fIwindow\fR
166 is destroyed. \fIWindow\fR must be the name of a widget specified
167 in the \fBhold\fR operation, otherwise an error is reported.
168 .TP
169 \fBbusy isbusy \fR?\fIpattern\fR?
170 Returns the pathnames of all widgets that are currently busy.
171 If a \fIpattern\fR is given, the path names of busy widgets
172 matching \fIpattern\fR are returned.
173 .TP
174 \fBbusy names \fR?\fIpattern\fR?
175 Returns the pathnames of all widgets that have previously been
176 made busy (i.e. a busy window is allocated and associated with the
177 widget). It makes no difference if the window is currently busy or
178 not. If a \fIpattern\fR is given, the path names of busy widgets
179 matching \fIpattern\fR are returned.
180 .TP
181 \fBbusy release \fIwindow\fR ?\fIwindow\fR?...
182 Restores user interactions to the widget \fIwindow\fR again.
183 This differs from the \fBforget\fR operation in that the busy window
184 is not destroyed, but simply unmapped.
185 \fIWindow\fR must be the name of a widget specified
186 in a \fBhold\fR operation, otherwise an error is reported.
187 .TP
188 \fBbusy status \fIwindow\fR
189 Returns the status of a widget \fIwindow\fR previously made busy.
190 An error is reported if \fIwindow\fR was never made busy, or
191 the \fBforget\fR operation was invoked (i.e. does not currently have a
192 busy window associated with it). If \fIwindow\fR is presently can
193 not receive user interactions, \fB1\fR is returned, otherwise \fB0\fR.
194 .sp 1
195 .SH BINDINGS
196 The event blocking feature is implemented by creating and mapping a
197 transparent window that completely covers the widget. When the busy
198 window is mapped, it invisibly shields the widget and its hierarchy
199 from all events that may be sent. Like Tk widgets, busy windows have
200 widget names in the Tk window hierarchy. This means that you can use
201 the \fBbind\fR command, to handle events in the busy window.
202 .CS
203 busy hold .frame.canvas
204 bind .frame.canvas_Busy <Enter> { ... }
205 .CE
206 .PP
207 Normally the busy window is a sibling of the widget. The
208 name of the busy window is "\fIwidget\fB_Busy\fR" where \fIwidget\fR
209 is the name of the widget to be made busy. In the previous example, the
210 pathname of the busy window is "\fB.frame.canvas_Busy\fR" The
211 exception is when the widget is a toplevel widget (such as ".") where
212 the busy window can't be made a sibling. The busy window is then a
213 child of the widget named "\fIwidget\fB._Busy\fR" where \fIwidget\fR
214 is the name of the toplevel widget. In the following example, the
215 pathname of the busy window is "\fB._Busy\fR"
216 .CS
217 busy hold .
218 bind ._Busy <Enter> { ... }
219 .CE
220 .SH ENTER/LEAVE EVENTS
221 Mapping and unmapping busy windows generates Enter/Leave events for
222 all widgets they cover. Please note this if you are tracking
223 Enter/Leave events in widgets.
224 .SH KEYBOARD EVENTS
225 When a widget is made busy, the widget is prevented from gaining the
226 keyboard focus by the busy window. But if the widget already had
227 focus, it still may received keyboard events. To prevent this, you
228 must move focus to another window.
229 .CS
230 busy hold .frame
231 label .dummy
232 focus .dummy
233 update
234 .CE
235 The above example moves the focus from .frame immediately after
236 invoking the \fBhold\fR so that no keyboard events will be sent to
237 \fB.frame\fR or any of its descendants.
238 .SH KEYWORDS
239 busy, keyboard events, pointer events, window, cursor
240
241