author | Claus Gittinger <cg@exept.de> |
Mon, 09 Jun 2008 17:17:20 +0200 | |
changeset 3442 | 5cd8447cf5a9 |
parent 3430 | 9fee581fff1d |
child 3542 | 3e9b8a2186da |
permissions | -rw-r--r-- |
62 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2563 | 12 |
"{ Package: 'stx:libwidg2' }" |
1789 | 13 |
|
50 | 14 |
View subclass:#ProgressIndicator |
826 | 15 |
instanceVariableNames:'percentage showPercentage fgColor bgColor connectedTop |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
16 |
connectedLabel collector finishAction closeTopWhenDone showBusy |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
17 |
busyPosition busyDelta busyIndicationProcess' |
183 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Misc' |
|
50 | 21 |
! |
22 |
||
334 | 23 |
!ProgressIndicator class methodsFor:'documentation'! |
50 | 24 |
|
62 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
50 | 39 |
documentation |
40 |
" |
|
41 |
a view showing a rectangle filled according the percentage value. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
42 |
Can be used as a progress indicator a la MSwindows; |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
43 |
it can also be configured as a non-percentage busy indication |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
44 |
via the showBusyIndication flag (a la netscape). |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
45 |
|
574 | 46 |
Can be used as a widget within an application, or |
47 |
via the convenient #inBox: instance creation messages, |
|
48 |
which shows a progressDisplay in a modalBox, while some |
|
49 |
action is performed. |
|
50 |
See examples. |
|
183 | 51 |
|
52 |
[author:] |
|
2563 | 53 |
Claus Gittinger |
183 | 54 |
|
55 |
[see also:] |
|
2563 | 56 |
ActionWaitBox AnimatedLabel |
50 | 57 |
" |
58 |
! |
|
59 |
||
60 |
examples |
|
61 |
" |
|
62 | 62 |
basic (internal) interface |
63 |
(if progress indicator is to be used in a complex box ...): |
|
50 | 64 |
|
183 | 65 |
Before you get frustrated - see the convenient-interface examples |
66 |
at the end ;-) |
|
67 |
||
2563 | 68 |
[exBegin] |
50 | 69 |
|top p h| |
70 |
||
62 | 71 |
top := ModalBox new. |
50 | 72 |
top extent:300@100. |
73 |
top label:'Progress'. |
|
74 |
p := ProgressIndicator in:top. |
|
75 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
76 |
p level:-1. |
|
62 | 77 |
h := p preferredExtent y. |
50 | 78 |
p topInset:(h // 2) negated; |
2563 | 79 |
bottomInset:(h // 2) negated; |
80 |
leftInset:5; |
|
81 |
rightInset:5. |
|
50 | 82 |
|
83 |
[ |
|
2563 | 84 |
1 to:100 do:[:val | |
85 |
(Delay forSeconds:0.05) wait. |
|
86 |
p percentage:val |
|
87 |
]. |
|
88 |
top hide. |
|
62 | 89 |
] fork. |
90 |
top open. |
|
2563 | 91 |
[exEnd] |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
92 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
93 |
as a busy indicator |
2563 | 94 |
[exBegin] |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
95 |
|top p h| |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
96 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
97 |
top := ModalBox new. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
98 |
top extent:300@100. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
99 |
top label:'Busy'. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
100 |
p := ProgressIndicator in:top. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
101 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
102 |
p level:-1. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
103 |
h := p preferredExtent y. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
104 |
p topInset:(h // 2) negated; |
2563 | 105 |
bottomInset:(h // 2) negated; |
106 |
leftInset:5; |
|
107 |
rightInset:5. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
108 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
109 |
p showBusyIndication:true. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
110 |
[ |
2563 | 111 |
'do something here ....'. |
112 |
(Delay forSeconds:5) wait. |
|
113 |
top hide. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
114 |
] fork. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
115 |
top open. |
2563 | 116 |
[exEnd] |
50 | 117 |
|
118 |
changing colors, turning percentage display off: |
|
2563 | 119 |
[exBegin] |
50 | 120 |
|top p h| |
121 |
||
122 |
top := StandardSystemView new. |
|
123 |
top extent:300@100. |
|
124 |
top label:'Progress'. |
|
125 |
p := ProgressIndicator in:top. |
|
126 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
127 |
p level:-1. |
|
128 |
p showPercentage:false. |
|
129 |
p foregroundColor:(Color red). |
|
130 |
h := 10. |
|
131 |
p topInset:(h // 2) negated; |
|
2563 | 132 |
bottomInset:(h // 2) negated; |
133 |
leftInset:5; |
|
134 |
rightInset:5. |
|
50 | 135 |
top open. |
136 |
[ |
|
2563 | 137 |
1 to:100 do:[:val | |
138 |
(Delay forSeconds:0.05) wait. |
|
139 |
p percentage:val |
|
140 |
] |
|
50 | 141 |
] fork |
2563 | 142 |
[exEnd] |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
143 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
144 |
as a busy indicator and percentage display (as in netscape) |
2563 | 145 |
[exBegin] |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
146 |
|top p h| |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
147 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
148 |
top := ModalBox new. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
149 |
top extent:300@60. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
150 |
top label:'Busy'. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
151 |
p := ProgressIndicator in:top. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
152 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
153 |
p level:-1. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
154 |
p showPercentage:false. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
155 |
p backgroundColor:(Color cyan). |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
156 |
h := p preferredExtent y. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
157 |
p topInset:(h // 3) negated; |
2563 | 158 |
bottomInset:(h // 3) negated; |
159 |
leftInset:5; |
|
160 |
rightInset:5. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
161 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
162 |
p showBusyIndication:true. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
163 |
[ |
2563 | 164 |
top label:'Busy'. |
165 |
1 to:100 do:[:i | |
|
166 |
(Delay forSeconds:0.05) wait. |
|
167 |
]. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
168 |
|
2563 | 169 |
top label:'Percentage'. |
170 |
p showBusyIndication:false. |
|
171 |
1 to:100 do:[:i | |
|
172 |
(Delay forSeconds:0.05) wait. |
|
173 |
p percentage:i. |
|
174 |
]. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
175 |
|
2563 | 176 |
top hide. |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
177 |
] fork. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
178 |
top open. |
2563 | 179 |
[exEnd] |
50 | 180 |
|
181 |
with border (2D look): |
|
2563 | 182 |
[exBegin] |
50 | 183 |
|top p h| |
184 |
||
185 |
top := StandardSystemView new. |
|
186 |
top extent:300@100. |
|
187 |
top label:'Progress'. |
|
188 |
p := ProgressIndicator in:top. |
|
189 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
190 |
p borderWidth:1. |
|
62 | 191 |
h := p preferredExtent y. |
50 | 192 |
p topInset:(h // 2) negated; |
2563 | 193 |
bottomInset:(h // 2) negated; |
194 |
leftInset:5; |
|
195 |
rightInset:5. |
|
50 | 196 |
top open. |
197 |
[ |
|
2563 | 198 |
1 to:100 do:[:val | |
199 |
(Delay forSeconds:0.05) wait. |
|
200 |
p percentage:val |
|
201 |
] |
|
50 | 202 |
] fork |
2563 | 203 |
[exEnd] |
50 | 204 |
|
205 |
||
206 |
getting progress from a model: |
|
2563 | 207 |
[exBegin] |
50 | 208 |
|model top p h| |
209 |
||
210 |
model := 0 asValue. |
|
211 |
||
212 |
top := StandardSystemView new. |
|
213 |
top extent:300@100. |
|
214 |
top label:'Progress'. |
|
215 |
p := ProgressIndicator in:top. |
|
216 |
p model:model. |
|
217 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
218 |
p level:-1. |
|
62 | 219 |
h := p preferredExtent y. |
50 | 220 |
p topInset:(h // 2) negated; |
2563 | 221 |
bottomInset:(h // 2) negated; |
222 |
leftInset:5; |
|
223 |
rightInset:5. |
|
50 | 224 |
top open. |
225 |
||
226 |
[ |
|
2563 | 227 |
1 to:100 do:[:val | |
228 |
(Delay forSeconds:0.05) wait. |
|
229 |
model value:val |
|
230 |
] |
|
50 | 231 |
] fork |
2563 | 232 |
[exEnd] |
50 | 233 |
|
62 | 234 |
|
50 | 235 |
concrete example: |
236 |
search all files in the source directory for a string |
|
237 |
using grep. Show progress while doing so. |
|
2563 | 238 |
[exBegin] |
50 | 239 |
|top p h names done| |
240 |
||
241 |
top := StandardSystemView new. |
|
242 |
top extent:300@100. |
|
243 |
top label:'Searching ...'. |
|
244 |
p := ProgressIndicator in:top. |
|
245 |
p origin:(0.0@0.5) corner:(1.0@0.5). |
|
246 |
p level:-1. |
|
62 | 247 |
h := p preferredExtent y. |
50 | 248 |
p topInset:(h // 2) negated; |
2563 | 249 |
bottomInset:(h // 2) negated; |
250 |
leftInset:5; |
|
251 |
rightInset:5. |
|
50 | 252 |
top openWithPriority:(Processor activePriority + 1). |
253 |
||
254 |
names := 'source' asFilename directoryContents. |
|
255 |
done := 0. |
|
256 |
names do:[:aName | |
|
2563 | 257 |
|fn stream line| |
50 | 258 |
|
2563 | 259 |
p percentage:(done / names size * 100). |
260 |
fn := ('source/' , aName) asFilename. |
|
261 |
fn isDirectory ifFalse:[ |
|
262 |
stream := fn readStream. |
|
263 |
[stream atEnd] whileFalse:[ |
|
264 |
line := stream nextLine. |
|
265 |
(line findString:'subclass:') ~~ 0 ifTrue:[ |
|
266 |
Transcript showCR:line |
|
267 |
]. |
|
268 |
]. |
|
269 |
stream close. |
|
270 |
]. |
|
271 |
done := done + 1 |
|
50 | 272 |
]. |
273 |
||
274 |
top destroy |
|
2563 | 275 |
[exEnd] |
62 | 276 |
|
277 |
||
278 |
using the convenient inBox-interface |
|
279 |
||
280 |
(this creates a box and an activity label and evaluates a block |
|
281 |
to indicate ...) |
|
282 |
||
283 |
basic interface demonstration: |
|
2563 | 284 |
[exBegin] |
62 | 285 |
|p| |
286 |
||
287 |
p := ProgressIndicator |
|
2563 | 288 |
inBoxWithLabel:'doing something ...' |
289 |
abortable:true. |
|
62 | 290 |
p showProgressOf: |
2563 | 291 |
[:progressValue :currentAction | |
62 | 292 |
|
2563 | 293 |
1 to:100 do:[:val | |
294 |
(Delay forSeconds:0.05) wait. |
|
295 |
val == 25 ifTrue:[ |
|
296 |
currentAction value:'still going ...' |
|
297 |
]. |
|
298 |
val == 50 ifTrue:[ |
|
299 |
currentAction value:'halfway through ...' |
|
300 |
]. |
|
301 |
val == 75 ifTrue:[ |
|
302 |
currentAction value:'almost finished ...' |
|
303 |
]. |
|
304 |
progressValue value:val |
|
305 |
] |
|
306 |
] |
|
307 |
[exEnd] |
|
62 | 308 |
|
309 |
||
310 |
above search example using this convenient interface: |
|
2563 | 311 |
[exBegin] |
62 | 312 |
|p| |
313 |
||
183 | 314 |
p := ProgressIndicator |
2563 | 315 |
inBoxWithLabel:'searching files ...' |
316 |
abortable:false. |
|
62 | 317 |
p showProgressOf: |
2563 | 318 |
[:progressValue :currentAction | |
319 |
|names nDone| |
|
62 | 320 |
|
2563 | 321 |
names := 'source' asFilename directoryContents. |
322 |
nDone := 0. |
|
323 |
names do:[:aName | |
|
324 |
|fn stream line| |
|
183 | 325 |
|
2563 | 326 |
progressValue value:(nDone / names size * 100). |
327 |
currentAction value:'searching ' , 'source/' , aName , ' ...'. |
|
62 | 328 |
|
2563 | 329 |
fn := ('source/' , aName) asFilename. |
330 |
fn isDirectory ifFalse:[ |
|
331 |
stream := fn readStream. |
|
332 |
[stream atEnd] whileFalse:[ |
|
333 |
line := stream nextLine. |
|
334 |
(line findString:'subclass:') ~~ 0 ifTrue:[ |
|
335 |
Transcript showCR:line |
|
336 |
]. |
|
337 |
]. |
|
338 |
stream close. |
|
339 |
]. |
|
340 |
nDone := nDone + 1 |
|
341 |
]. |
|
342 |
]. |
|
343 |
[exEnd] |
|
62 | 344 |
|
345 |
||
346 |
a nice example: copying files a la windows ... |
|
183 | 347 |
the following copies all files to /dev/null. |
2563 | 348 |
[exBegin] |
62 | 349 |
|p| |
350 |
||
351 |
(ProgressIndicator |
|
2563 | 352 |
inBoxWithLabel:'copy files to /dev/null ...' |
353 |
abortable:true) |
|
354 |
showProgressOf: |
|
355 |
[:progressValue :currentAction | |
|
356 |
|files nFiles nDone| |
|
62 | 357 |
|
2563 | 358 |
files := '.' asFilename directoryContents. |
359 |
nFiles := files size. |
|
360 |
nDone := 0. |
|
361 |
files do:[:aFileName | |
|
362 |
|percent| |
|
50 | 363 |
|
2563 | 364 |
nDone := nDone + 1. |
365 |
percent := nDone / nFiles * 100. |
|
366 |
progressValue value:percent. |
|
367 |
aFileName asFilename isDirectory ifTrue:[ |
|
368 |
Transcript showCR:('skipping ' , aFileName , ' ...'). |
|
369 |
currentAction value:('skipping ' , aFileName , ' ...'). |
|
370 |
] ifFalse:[ |
|
371 |
Transcript showCR:('copying ' , aFileName , ' ...'). |
|
372 |
currentAction value:('copying ' , aFileName , ' ...'). |
|
373 |
Object errorSignal handle:[:ex | |
|
374 |
self warn:'an error occurred while copying ' , aFileName. |
|
375 |
ex return |
|
376 |
] do:[ |
|
377 |
aFileName asFilename copyTo:'/dev/null'. |
|
378 |
] |
|
379 |
]. |
|
380 |
]. |
|
381 |
]. |
|
382 |
[exEnd] |
|
183 | 383 |
" |
50 | 384 |
! ! |
385 |
||
334 | 386 |
!ProgressIndicator class methodsFor:'instance creation'! |
62 | 387 |
|
3442 | 388 |
displayBusyIndicator:aLabel abortable:abortable at:aPoint during:aBlock |
2850 | 389 |
"easy interface - show progress while evaluating aBlock. |
390 |
The block is passed a valueHolder, which is to be set to values from |
|
391 |
startValue to endValue during the blocks evaluation. |
|
392 |
This is scaled to 0..100% completion. |
|
393 |
Set the valueHolder to nil, to get a busy-indicator" |
|
394 |
||
395 |
|p| |
|
396 |
||
397 |
p := self |
|
398 |
inBoxWithLabel:aLabel |
|
399 |
icon:nil |
|
400 |
text:aLabel |
|
3442 | 401 |
abortable:abortable |
2850 | 402 |
view:nil |
403 |
closeWhenDone:true. |
|
404 |
||
405 |
p showBusyIndication:true. |
|
406 |
p showBusyIndicatorDuring:[ |
|
2931 | 407 |
CannotReturnError catch:[ |
3430 | 408 |
aBlock valueWithOptionalArgument:p. |
2850 | 409 |
] |
410 |
] |
|
411 |
||
412 |
" |
|
413 |
ProgressIndicator |
|
414 |
displayBusyIndicator:'doobidoobidoo...' |
|
415 |
at:(Screen default center) |
|
416 |
during:[ |
|
417 |
200 to:400 by:5 do:[:i | |
|
418 |
Delay waitForSeconds:0.1. |
|
419 |
] |
|
420 |
]. |
|
421 |
" |
|
422 |
! |
|
423 |
||
3442 | 424 |
displayBusyIndicator:aLabel at:aPoint during:aBlock |
425 |
"easy interface - show progress while evaluating aBlock. |
|
426 |
The block is passed a valueHolder, which is to be set to values from |
|
427 |
startValue to endValue during the blocks evaluation. |
|
428 |
This is scaled to 0..100% completion. |
|
429 |
Set the valueHolder to nil, to get a busy-indicator" |
|
430 |
||
431 |
self |
|
432 |
displayBusyIndicator:aLabel |
|
433 |
abortable:false |
|
434 |
at:aPoint |
|
435 |
during:aBlock |
|
436 |
! |
|
437 |
||
1462 | 438 |
displayProgress:aLabel at:aPoint from:startValue to:endValue during:aBlock |
439 |
"easy interface - show progress while evaluating aBlock. |
|
440 |
The block is passed a valueHolder, which is to be set to values from |
|
441 |
startValue to endValue during the blocks evaluation. |
|
2435 | 442 |
This is scaled to 0..100% completion. |
443 |
Set the valueHolder to nil, to get a busy-indicator" |
|
1462 | 444 |
|
445 |
|p| |
|
446 |
||
447 |
p := self |
|
2931 | 448 |
inBoxWithLabel:aLabel |
449 |
icon:nil |
|
450 |
text:aLabel |
|
451 |
abortable:false |
|
452 |
view:nil |
|
453 |
closeWhenDone:true. |
|
1462 | 454 |
|
455 |
p showProgressOf:[:progressValue :currentAction | |
|
2931 | 456 |
|scaler| |
1463 | 457 |
|
2931 | 458 |
scaler := [:scaledValue | |
459 |
|newPercentage oldPercentage oldLabel| |
|
2435 | 460 |
|
2931 | 461 |
scaledValue isNil ifTrue:[ |
462 |
p showBusyIndication:true |
|
463 |
] ifFalse:[ |
|
464 |
p showBusyIndication:false. |
|
465 |
oldPercentage := progressValue value. |
|
466 |
newPercentage := (scaledValue - startValue) / (endValue-startValue) * 100. |
|
467 |
newPercentage ~= oldPercentage ifTrue:[ |
|
468 |
progressValue value:newPercentage. |
|
469 |
]. |
|
470 |
oldLabel := currentAction value. |
|
471 |
oldLabel ~= aLabel ifTrue:[ |
|
472 |
currentAction value:aLabel. |
|
473 |
] |
|
474 |
] |
|
475 |
]. |
|
476 |
CannotReturnError catch:[ |
|
3430 | 477 |
aBlock valueWithOptionalArgument:scaler and:p. |
2931 | 478 |
] |
1462 | 479 |
] |
480 |
||
481 |
" |
|
482 |
ProgressIndicator |
|
2931 | 483 |
displayProgress:'doobidoobidoo...' |
484 |
at:(Screen default center) |
|
3430 | 485 |
from:200 to:400 |
2931 | 486 |
during:[:val | |
487 |
200 to:400 by:5 do:[:i | |
|
488 |
val value:i. |
|
489 |
Delay waitForSeconds:0.1. |
|
490 |
] |
|
491 |
]. |
|
1462 | 492 |
" |
493 |
! |
|
494 |
||
62 | 495 |
inBox |
574 | 496 |
"create a topView containing an instance of myself, |
497 |
for later use with #showProgressOf:" |
|
498 |
||
499 |
^ self inBoxWithLabel:'executing ...' abortable:false |
|
500 |
||
501 |
"Modified: 22.10.1997 / 21:08:37 / cg" |
|
62 | 502 |
! |
503 |
||
504 |
inBoxWithLabel:aLabel |
|
505 |
"create a topView containing an instance of myself, |
|
506 |
for later use with #showProgressOf:" |
|
507 |
||
508 |
^ self inBoxWithLabel:aLabel abortable:false |
|
509 |
! |
|
510 |
||
511 |
inBoxWithLabel:aLabel abortable:abortable |
|
512 |
"create a topView containing an instance of myself, |
|
513 |
for later use with #showProgressOf:" |
|
514 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
515 |
^ self |
634 | 516 |
inBoxWithLabel:aLabel |
517 |
text:'' |
|
518 |
abortable:abortable |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
519 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
520 |
"Modified: 17.7.1996 / 15:14:58 / cg" |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
521 |
! |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
522 |
|
237 | 523 |
inBoxWithLabel:aLabel icon:anIcon text:text abortable:abortable view:additionalView closeWhenDone:closeWhenDoneBoolean |
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
524 |
"create a topView containing an instance of myself, |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
525 |
for later use with #showProgressOf:" |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
526 |
|
2436 | 527 |
|top p l y y2| |
62 | 528 |
|
529 |
top := Dialog new. |
|
530 |
top label:aLabel. |
|
531 |
top cursor:(Cursor wait). |
|
826 | 532 |
y2 := 0. |
237 | 533 |
anIcon notNil ifTrue:[ |
3425
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
534 |
y := top yPosition. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
535 |
l := top addTextLabel:anIcon. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
536 |
l borderWidth:0. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
537 |
l adjust:#left. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
538 |
l cursor:(Cursor wait). |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
539 |
y2 := top yPosition. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
540 |
top yPosition:y. |
237 | 541 |
]. |
542 |
||
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
543 |
l := top addTextLabel:text. |
62 | 544 |
l borderWidth:0. |
74 | 545 |
l adjust:#left. |
62 | 546 |
l cursor:(Cursor wait). |
826 | 547 |
anIcon notNil ifTrue: [l leftInset:(anIcon width + 10)]. |
237 | 548 |
|
549 |
top yPosition:(top yPosition max:y2). |
|
62 | 550 |
|
551 |
top addVerticalSpace. |
|
552 |
||
553 |
p := ProgressIndicator new. |
|
3425
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
554 |
p extent:(1.0 @ p preferredHeight). |
62 | 555 |
p level:-1. |
556 |
p leftInset:5; |
|
557 |
rightInset:5. |
|
558 |
p cursor:(Cursor wait). |
|
237 | 559 |
p closeTopWhenDone:closeWhenDoneBoolean. |
62 | 560 |
p connectToTop:top label:l. |
561 |
||
562 |
top addComponent:p. |
|
563 |
||
237 | 564 |
additionalView notNil ifTrue:[ |
3425
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
565 |
top addComponent:additionalView. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
566 |
additionalView extent:(1.0 @ additionalView preferredHeight). |
237 | 567 |
]. |
568 |
||
62 | 569 |
abortable ifTrue:[ |
3425
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
570 |
top addVerticalSpace. |
20459e327062
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
571 |
top addAbortButton |
62 | 572 |
]. |
573 |
||
574 |
^ p |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
575 |
|
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
576 |
"Created: 17.7.1996 / 15:14:33 / cg" |
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
577 |
"Modified: 17.7.1996 / 15:16:58 / cg" |
237 | 578 |
! |
579 |
||
580 |
inBoxWithLabel:aLabel text:text abortable:abortable |
|
581 |
"create a topView containing an instance of myself, |
|
582 |
for later use with #showProgressOf:" |
|
583 |
||
584 |
^ self |
|
634 | 585 |
inBoxWithLabel:aLabel |
586 |
text:text |
|
587 |
abortable:abortable |
|
588 |
view:nil |
|
237 | 589 |
|
590 |
! |
|
591 |
||
592 |
inBoxWithLabel:aLabel text:text abortable:abortable view:additionalView |
|
593 |
"create a topView containing an instance of myself, |
|
594 |
for later use with #showProgressOf:" |
|
595 |
||
596 |
^ self |
|
634 | 597 |
inBoxWithLabel:aLabel |
598 |
text:text |
|
599 |
abortable:abortable |
|
600 |
view:additionalView |
|
601 |
closeWhenDone:true |
|
237 | 602 |
|
603 |
! |
|
604 |
||
605 |
inBoxWithLabel:aLabel text:text abortable:abortable view:additionalView closeWhenDone:closeWhenDoneBoolean |
|
606 |
"create a topView containing an instance of myself, |
|
607 |
for later use with #showProgressOf:" |
|
608 |
||
609 |
^ self |
|
634 | 610 |
inBoxWithLabel:aLabel |
611 |
icon:nil |
|
612 |
text:text |
|
613 |
abortable:abortable |
|
614 |
view:additionalView |
|
615 |
closeWhenDone:closeWhenDoneBoolean |
|
237 | 616 |
|
1681
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
617 |
! |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
618 |
|
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
619 |
progressOpenOn:progressModel label:aLabel |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
620 |
"create and open a progressIndicator dialog window, |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
621 |
bit do not open it modal; instead, it is opened modeless |
1834
ba170c21ed76
defaultExtent computation fixed
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
622 |
and control returns to the caller. |
1681
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
623 |
The models value is assumed to be 0..1 |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
624 |
(which is for compatibility and different from ST/X's percentage use) |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
625 |
Added for VW compatibility (RB)." |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
626 |
|
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
627 |
|p ra| |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
628 |
|
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
629 |
p := self |
2563 | 630 |
inBoxWithLabel:aLabel |
631 |
icon:nil |
|
632 |
text:aLabel |
|
633 |
abortable:false |
|
634 |
view:nil |
|
635 |
closeWhenDone:false. |
|
1681
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
636 |
|
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
637 |
ra := RangeAdaptor on:progressModel start:0 stop:0.01 grid:nil. |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
638 |
p model:ra. |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
639 |
|
2132 | 640 |
p topView openModeless; waitUntilVisible. |
1681
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
641 |
^ p. |
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
642 |
|
9ef9e8ec0f43
progressOpenOn:label: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
1463
diff
changeset
|
643 |
"Modified: / 4.2.2000 / 01:25:55 / cg" |
62 | 644 |
! ! |
645 |
||
183 | 646 |
!ProgressIndicator methodsFor:'accessing'! |
647 |
||
334 | 648 |
percentage:aNumber |
649 |
"set the percentage" |
|
237 | 650 |
|
183 | 651 |
|newPercentage| |
652 |
||
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
653 |
aNumber < 0 ifTrue:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
654 |
newPercentage := -1. |
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
655 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
656 |
newPercentage := ((aNumber max:0) min:100) rounded. |
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
657 |
]. |
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
658 |
newPercentage ~= percentage ifTrue:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
659 |
percentage := newPercentage. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
660 |
self invalidateRepairNow:true. |
183 | 661 |
] |
334 | 662 |
|
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
663 |
"Modified: / 6.6.1998 / 19:43:56 / cg" |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
664 |
! |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
665 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
666 |
showBusyIndication:aBooleanHolder |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
667 |
"switch between percentage mode (if false) and busy indication (if true)" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
668 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
669 |
aBooleanHolder ~~ showBusy ifTrue:[ |
2563 | 670 |
showBusy notNil ifTrue:[ |
671 |
showBusy removeDependent:self. |
|
672 |
]. |
|
673 |
showBusy := aBooleanHolder. |
|
674 |
showBusy addDependent:self. |
|
675 |
(showBusy value) ifTrue:[ |
|
676 |
self startBusyIndicationProcess. |
|
677 |
] ifFalse:[ |
|
678 |
self stopBusyIndicationProcess |
|
679 |
]. |
|
680 |
shown ifTrue:[self redraw] |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
681 |
]. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
682 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
683 |
"Created: / 21.10.1998 / 17:35:16 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
684 |
"Modified: / 21.10.1998 / 18:03:06 / cg" |
334 | 685 |
! ! |
686 |
||
2404 | 687 |
!ProgressIndicator methodsFor:'accessing-behavior'! |
688 |
||
689 |
closeTopWhenDone:aBoolean |
|
690 |
"set/clear the close-topView-when-done flag" |
|
691 |
||
692 |
closeTopWhenDone := aBoolean |
|
693 |
||
694 |
"Created: 3.9.1996 / 14:22:03 / cg" |
|
695 |
"Modified: 29.3.1997 / 16:08:19 / cg" |
|
696 |
! |
|
697 |
||
698 |
finishAction:aBlock |
|
699 |
"define an action to be performed when finished" |
|
700 |
||
701 |
finishAction := aBlock |
|
702 |
||
703 |
"Created: 3.9.1996 / 14:15:15 / cg" |
|
704 |
"Modified: 29.3.1997 / 16:08:35 / cg" |
|
705 |
! ! |
|
706 |
||
707 |
!ProgressIndicator methodsFor:'accessing-look'! |
|
334 | 708 |
|
826 | 709 |
backgroundColor |
710 |
"return the percentage displays background color" |
|
711 |
||
712 |
^ bgColor |
|
713 |
||
714 |
! |
|
715 |
||
716 |
backgroundColor:aColor |
|
717 |
"set the percentage displays background color" |
|
718 |
||
993 | 719 |
aColor ~= bgColor ifTrue:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
720 |
bgColor := aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
721 |
self invalidateRepairNow:true |
826 | 722 |
]. |
723 |
||
993 | 724 |
"Modified: / 20.7.1998 / 23:32:48 / cg" |
826 | 725 |
! |
726 |
||
335
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
727 |
foregroundColor |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
728 |
"return the percentage displays foreground color" |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
729 |
|
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
730 |
^ fgColor |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
731 |
|
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
732 |
"Created: 29.3.1997 / 16:12:28 / cg" |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
733 |
! |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
734 |
|
334 | 735 |
foregroundColor:aColor |
736 |
"set the percentage displays foreground color" |
|
737 |
||
993 | 738 |
aColor ~= fgColor ifTrue:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
739 |
fgColor := aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
740 |
self invalidateRepairNow:true |
336 | 741 |
]. |
334 | 742 |
|
993 | 743 |
"Modified: / 20.7.1998 / 23:27:47 / cg" |
183 | 744 |
! |
745 |
||
335
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
746 |
showPercentage |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
747 |
"return the flag controlling if the percentage is to be shown numerically" |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
748 |
|
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
749 |
^ showPercentage |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
750 |
|
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
751 |
"Created: 29.3.1997 / 16:12:39 / cg" |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
752 |
! |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
753 |
|
183 | 754 |
showPercentage:aBoolean |
334 | 755 |
"set/clear the flag controlling if the percentage is to be shown numerically" |
756 |
||
336 | 757 |
showPercentage := aBoolean. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
758 |
self invalidateRepairNow:true |
334 | 759 |
|
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
760 |
"Modified: / 6.6.1998 / 19:28:44 / cg" |
183 | 761 |
! ! |
762 |
||
763 |
!ProgressIndicator methodsFor:'change & update'! |
|
764 |
||
765 |
update:aspect with:aParameter from:changedObject |
|
574 | 766 |
"react upon value changes of my model" |
767 |
||
183 | 768 |
(aspect == aspectMsg |
769 |
and:[changedObject == model]) ifTrue:[ |
|
2563 | 770 |
self percentage:(model perform:aspectMsg). |
771 |
^ self |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
772 |
]. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
773 |
changedObject == showBusy ifTrue:[ |
2563 | 774 |
self redraw. |
775 |
^ self |
|
183 | 776 |
]. |
777 |
^ super update:aspect with:aParameter from:changedObject |
|
574 | 778 |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
779 |
"Modified: / 21.10.1998 / 18:01:52 / cg" |
183 | 780 |
! ! |
781 |
||
782 |
!ProgressIndicator methodsFor:'drawing'! |
|
783 |
||
784 |
redraw |
|
574 | 785 |
"redraw the percentage bar and optional percentage string" |
786 |
||
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
787 |
|s lx rx sx sy sw m2 m w h doBusy| |
183 | 788 |
|
789 |
m := margin + 1. |
|
863 | 790 |
m2 := m*2. |
791 |
||
792 |
w := width - m2. |
|
793 |
h := height - m2. |
|
183 | 794 |
|
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
865
diff
changeset
|
795 |
"/ self clear. |
863 | 796 |
|
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
797 |
doBusy := showBusy value. |
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
798 |
doBusy ifFalse:[ |
2563 | 799 |
percentage value < 0 ifTrue:[ |
800 |
self startBusyIndicationProcess. |
|
801 |
doBusy := true. |
|
802 |
]. |
|
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
803 |
]. |
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
804 |
|
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
805 |
doBusy ifTrue:[ |
2563 | 806 |
self paint:bgColor. |
807 |
self fillRectangleX:m y:m width:w height:h. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
808 |
|
2563 | 809 |
lx := (w * busyPosition / 100) rounded. |
810 |
rx := (w * (busyPosition + 20) / 100) rounded. |
|
811 |
rx := rx min:w. |
|
812 |
lx := lx max:m. |
|
813 |
self paint:fgColor. |
|
814 |
self fillRectangleX:lx y:m width:(rx - lx) height:h. |
|
815 |
^ self |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
816 |
]. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
817 |
|
2040
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
818 |
self stopBusyIndicationProcess. |
702df7addef9
busy indicator when percentage is negative
Claus Gittinger <cg@exept.de>
parents:
1935
diff
changeset
|
819 |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
820 |
rx := (w * percentage / 100) rounded. |
826 | 821 |
self paint:bgColor. |
843 | 822 |
self fillRectangleX:m+rx y:m width:w-rx height:h. |
183 | 823 |
|
824 |
showPercentage ifTrue:[ |
|
2563 | 825 |
s := percentage printString , ' %'. |
826 |
font := font onDevice:device. |
|
827 |
sw := font widthOf:s . |
|
828 |
sx := (width - sw) // 2. |
|
829 |
sy := height // 2 + font descent + 2. |
|
347 | 830 |
|
2563 | 831 |
rx <= (sx+sw) ifTrue:[ |
832 |
self paint:Color black. |
|
833 |
self displayString:s x:sx y:sy. |
|
834 |
] |
|
183 | 835 |
]. |
836 |
||
837 |
self paint:fgColor. |
|
838 |
self fillRectangleX:m y:m width:rx height:h. |
|
839 |
||
840 |
showPercentage ifTrue:[ |
|
2563 | 841 |
rx >= sx ifTrue:[ |
842 |
self clippingRectangle:(m@m corner:rx+1 @ h). |
|
843 |
self paint:Color white. |
|
844 |
self displayString:s x:sx y:sy. |
|
845 |
self clippingRectangle:nil |
|
846 |
] |
|
183 | 847 |
] |
347 | 848 |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
849 |
"Modified: / 21.10.1998 / 18:01:58 / cg" |
863 | 850 |
! |
851 |
||
852 |
sizeChanged:how |
|
853 |
super sizeChanged:how. |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
854 |
self invalidate |
863 | 855 |
|
856 |
"Created: / 18.4.1998 / 02:34:37 / cg" |
|
865 | 857 |
"Modified: / 18.4.1998 / 14:09:40 / cg" |
183 | 858 |
! ! |
859 |
||
2501 | 860 |
!ProgressIndicator methodsFor:'initialization & release'! |
183 | 861 |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
862 |
destroy |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
863 |
busyIndicationProcess notNil ifTrue:[ |
2563 | 864 |
self stopBusyIndicationProcess |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
865 |
]. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
866 |
super destroy. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
867 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
868 |
"Created: / 21.10.1998 / 17:29:58 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
869 |
"Modified: / 21.10.1998 / 17:30:36 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
870 |
! |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
871 |
|
574 | 872 |
initStyle |
873 |
"initialize styleSheet values" |
|
335
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
874 |
|
575 | 875 |
<resource: #style (#'progressIndicator.viewBackground' |
2921 | 876 |
#'progressIndicator.foregroundColor')> |
574 | 877 |
|
878 |
super initStyle. |
|
335
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
879 |
|
347 | 880 |
self is3D ifTrue:[ |
2921 | 881 |
self level:-1 |
347 | 882 |
]. |
883 |
||
826 | 884 |
bgColor := styleSheet colorAt:'progressIndicator.viewBackground' default:Color white. |
574 | 885 |
fgColor := styleSheet colorAt:'progressIndicator.foregroundColor' default:Color blue. |
335
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
886 |
fgColor := fgColor onDevice:device. |
6f007bdeae94
resource-tag & access methods.
Claus Gittinger <cg@exept.de>
parents:
334
diff
changeset
|
887 |
|
183 | 888 |
showPercentage := true. |
574 | 889 |
! |
890 |
||
891 |
initialize |
|
826 | 892 |
|
574 | 893 |
super initialize. |
826 | 894 |
|
574 | 895 |
percentage := 0. |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
896 |
showBusy := false. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
897 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
898 |
"Modified: / 21.10.1998 / 17:33:02 / cg" |
1935
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
899 |
! |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
900 |
|
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
901 |
mapped |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
902 |
super mapped. |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
903 |
(showBusy value) ifTrue:[ |
2563 | 904 |
self startBusyIndicationProcess. |
1935
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
905 |
]. |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
906 |
! |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
907 |
|
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
908 |
unmapped |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
909 |
super unmapped. |
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
910 |
(showBusy value) ifTrue:[ |
2563 | 911 |
self stopBusyIndicationProcess. |
1935
a2338e64cf2f
terminate/recreate busyIndicator-animation process if unmapped/mapped
frank
parents:
1852
diff
changeset
|
912 |
]. |
574 | 913 |
! ! |
914 |
||
915 |
!ProgressIndicator methodsFor:'private'! |
|
916 |
||
917 |
connectToTop:top label:label |
|
918 |
connectedTop := top. |
|
919 |
connectedLabel := label |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
920 |
! |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
921 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
922 |
startBusyIndicationProcess |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
923 |
busyIndicationProcess isNil ifTrue:[ |
2563 | 924 |
busyPosition := 0. |
925 |
busyDelta := 5. |
|
926 |
busyIndicationProcess := [ |
|
927 |
[self realized] whileTrue:[ |
|
928 |
Delay waitForSeconds:0.2. |
|
929 |
self shown ifTrue:[ |
|
930 |
self updateBusyIndicatorPosition. |
|
931 |
] |
|
932 |
]. |
|
933 |
busyIndicationProcess := nil. |
|
934 |
] fork. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
935 |
]. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
936 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
937 |
"Created: / 21.10.1998 / 18:02:35 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
938 |
"Modified: / 21.10.1998 / 18:03:49 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
939 |
! |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
940 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
941 |
stopBusyIndicationProcess |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
942 |
busyIndicationProcess notNil ifTrue:[ |
2563 | 943 |
busyIndicationProcess terminate. |
944 |
busyIndicationProcess := nil |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
945 |
]. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
946 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
947 |
"Created: / 21.10.1998 / 17:30:19 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
948 |
! |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
949 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
950 |
updateBusyIndicatorPosition |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
951 |
busyPosition := busyPosition + busyDelta. |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
952 |
busyPosition >= 80 ifTrue:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
953 |
busyDelta > 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
954 |
busyDelta := busyDelta negated. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
955 |
] |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
956 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
957 |
busyPosition <= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
958 |
busyDelta < 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
959 |
busyDelta := busyDelta negated. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
960 |
] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
961 |
] |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
962 |
]. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2563
diff
changeset
|
963 |
self invalidate |
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
964 |
|
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
965 |
"Created: / 21.10.1998 / 17:33:28 / cg" |
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
966 |
"Modified: / 21.10.1998 / 17:58:58 / cg" |
183 | 967 |
! ! |
968 |
||
969 |
!ProgressIndicator methodsFor:'queries'! |
|
970 |
||
971 |
preferredExtent |
|
574 | 972 |
"return my preferred extent" |
973 |
||
334 | 974 |
preferredExtent notNil ifTrue:[ |
634 | 975 |
^ preferredExtent |
334 | 976 |
]. |
183 | 977 |
^ 100 @ (font height + font descent + ((margin + 1) * 2)) |
334 | 978 |
|
574 | 979 |
"Modified: 22.10.1997 / 21:07:17 / cg" |
183 | 980 |
! ! |
981 |
||
62 | 982 |
!ProgressIndicator methodsFor:'showing progress'! |
983 |
||
2850 | 984 |
showBusyIndicatorDuring:aBlock |
985 |
"show progress, while evaluating aBlock. |
|
986 |
If the receiver has been created with inBox, show the |
|
987 |
box centered on the screen. If not, the view is assumed to |
|
988 |
be contained in another view, and no special startup actions |
|
989 |
are performed. |
|
990 |
||
991 |
Caveat: cannot (currently) suppress close of the box ..." |
|
992 |
||
993 |
|labelValue p| |
|
994 |
||
995 |
connectedLabel notNil ifTrue:[ |
|
996 |
labelValue := (connectedLabel label ? '') asValue. |
|
997 |
connectedLabel |
|
998 |
model:labelValue; |
|
999 |
aspect:#value; |
|
1000 |
labelMessage:#value. |
|
1001 |
] ifFalse:[ |
|
1002 |
labelValue := '' asValue. |
|
1003 |
]. |
|
1004 |
||
1005 |
||
1006 |
"/ the worker process |
|
1007 |
||
1008 |
p := [ |
|
1009 |
[ |
|
1010 |
WindowGroup windowGroupQuerySignal handle:[:ex | |
|
1011 |
ex proceedWith:self topView windowGroup |
|
1012 |
] do:[ |
|
1013 |
aBlock value |
|
1014 |
] |
|
1015 |
] ensure:[ |
|
1016 |
p := nil. |
|
1017 |
closeTopWhenDone ifTrue:[ |
|
1018 |
connectedTop hide |
|
1019 |
]. |
|
1020 |
finishAction value |
|
1021 |
] |
|
1022 |
] newProcess. |
|
1023 |
||
1024 |
Processor activeProcess |
|
2878 | 1025 |
withHigherPriorityDo: |
1026 |
[ |
|
1027 |
p resume. |
|
1028 |
self topView show. |
|
1029 |
]. |
|
2850 | 1030 |
p notNil ifTrue:[p terminate]. |
1031 |
||
1032 |
" |
|
1033 |
|p| |
|
1034 |
||
1035 |
p := ProgressIndicator inBox. |
|
1036 |
p showBusyIndication:true. |
|
1037 |
p showProgressOf: |
|
1038 |
[:progressValue :currentAction | |
|
1039 |
1 to:200 do:[:percent | |
|
1040 |
(Delay forSeconds:0.05) wait. |
|
1041 |
progressValue value:percent |
|
1042 |
]. |
|
1043 |
]. |
|
1044 |
||
1045 |
'it can be reused ...'. |
|
1046 |
p showBusyIndication:false. |
|
1047 |
p showProgressOf: |
|
1048 |
[:progressValue :currentAction | |
|
1049 |
1 to:100 by:5 do:[:percent | |
|
1050 |
(Delay forSeconds:0.05) wait. |
|
1051 |
progressValue value:percent |
|
1052 |
]. |
|
1053 |
]. |
|
1054 |
||
1055 |
" |
|
1056 |
||
1057 |
"Modified: / 21.10.1998 / 17:37:00 / cg" |
|
1058 |
! |
|
1059 |
||
62 | 1060 |
showProgressOf:aBlock |
1061 |
"show progress, while evaluating aBlock. |
|
1062 |
If the receiver has been created with inBox, show the |
|
1063 |
box centered on the screen. If not, the view is assumed to |
|
1064 |
be contained in another view, and no special startup actions |
|
1065 |
are performed. |
|
1066 |
||
1067 |
The block is passed two arguments, the progressValue, |
|
1068 |
which should be set to the percentage from time-to-time |
|
1069 |
within the block and an action value, which should be set to |
|
1070 |
the currently performed action (a string) from time to time. |
|
1071 |
The second valueHolder can be left unchanged. |
|
1072 |
||
1073 |
Caveat: cannot (currently) suppress close of the box ..." |
|
1074 |
||
221 | 1075 |
|progressValue labelValue p| |
62 | 1076 |
|
1077 |
progressValue := 0 asValue. |
|
1078 |
||
1079 |
connectedLabel notNil ifTrue:[ |
|
2837 | 1080 |
labelValue := (connectedLabel label ? '') asValue. |
1081 |
connectedLabel |
|
1082 |
model:labelValue; |
|
1083 |
aspect:#value; |
|
1084 |
labelMessage:#value. |
|
1834
ba170c21ed76
defaultExtent computation fixed
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1085 |
] ifFalse:[ |
2837 | 1086 |
labelValue := '' asValue. |
62 | 1087 |
]. |
1088 |
||
1834
ba170c21ed76
defaultExtent computation fixed
Claus Gittinger <cg@exept.de>
parents:
1789
diff
changeset
|
1089 |
|
62 | 1090 |
self model:progressValue. |
1091 |
||
221 | 1092 |
"/ the worker process |
1093 |
||
62 | 1094 |
p := [ |
2837 | 1095 |
[ |
1096 |
WindowGroup windowGroupQuerySignal handle:[:ex | |
|
1097 |
ex proceedWith:self topView windowGroup |
|
1098 |
] do:[ |
|
1099 |
aBlock value:progressValue value:labelValue |
|
1100 |
] |
|
1101 |
] ensure:[ |
|
1102 |
p := nil. |
|
1103 |
closeTopWhenDone ifTrue:[ |
|
1104 |
connectedTop hide |
|
1105 |
]. |
|
1106 |
finishAction value |
|
1107 |
] |
|
1850 | 1108 |
] newProcess. |
62 | 1109 |
|
237 | 1110 |
Processor activeProcess |
2878 | 1111 |
withHigherPriorityDo:[ |
2837 | 1112 |
p resume. |
1113 |
self topView show. |
|
1114 |
]. |
|
237 | 1115 |
p notNil ifTrue:[p terminate]. |
62 | 1116 |
|
1117 |
" |
|
1118 |
|p| |
|
1119 |
||
1120 |
p := ProgressIndicator inBox. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
1121 |
p showBusyIndication:true. |
62 | 1122 |
p showProgressOf: |
2837 | 1123 |
[:progressValue :currentAction | |
1124 |
1 to:200 do:[:percent | |
|
1125 |
(Delay forSeconds:0.05) wait. |
|
1126 |
progressValue value:percent |
|
1127 |
]. |
|
1128 |
]. |
|
62 | 1129 |
|
1130 |
'it can be reused ...'. |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
1131 |
p showBusyIndication:false. |
62 | 1132 |
p showProgressOf: |
2837 | 1133 |
[:progressValue :currentAction | |
1134 |
1 to:100 by:5 do:[:percent | |
|
1135 |
(Delay forSeconds:0.05) wait. |
|
1136 |
progressValue value:percent |
|
1137 |
]. |
|
1138 |
]. |
|
62 | 1139 |
|
1140 |
" |
|
219
44246b9b4288
use new windowGroupQuery for background process
Claus Gittinger <cg@exept.de>
parents:
201
diff
changeset
|
1141 |
|
1168
35e46761842f
added showBusyIndication mode
Claus Gittinger <cg@exept.de>
parents:
993
diff
changeset
|
1142 |
"Modified: / 21.10.1998 / 17:37:00 / cg" |
62 | 1143 |
! ! |
1144 |
||
334 | 1145 |
!ProgressIndicator class methodsFor:'documentation'! |
50 | 1146 |
|
183 | 1147 |
version |
3442 | 1148 |
^ '$Header: /cvs/stx/stx/libwidg2/ProgressIndicator.st,v 1.55 2008-06-09 15:17:20 cg Exp $' |
50 | 1149 |
! ! |