-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHDI_progress.4dm
79 lines (58 loc) · 1.79 KB
/
HDI_progress.4dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//%attributes = {}
var $i : Integer
var $o : Object
var $progress : cs:C1710.progress
// Display a progress by giving a title, a predefined icon "check" and a message
$o:={\
title: "Copy files"; \
icon: "check"; \
message: "We're doing some preliminary work..."\
}
$progress:=cs:C1710.progress.new($o)
// Giving the impression that we're doing something ;-)
DELAY PROCESS:C323(Current process:C322; 120)
// Now that we're ready, let's update :
// - Change to an indexed progress bar with a predefined "file" icon
// - If we define a stop formula, the Stop button will be displayed automatically.
// - If the message is empty, the percentage of completion is automatically displayed.
$progress.properties:={\
message: ""; \
stopFormula: Formula:C1597(_confirm); \
icon: "file"; \
type: "indexed"; \
calculationMessage: "Calculation in progress..."; \
cancellationMessage: "We're cancelling..."\
}
$progress.BringToFront()
// Giving the impression that we're doing something ;-)
DELAY PROCESS:C323(Current process:C322; 15)
For ($i; 1; 100; 1)
// Giving the impression that we're doing something ;-)
DELAY PROCESS:C323(Current process:C322; 5)
If (Milliseconds:C459%3=0)\
| ($i=100)
$progress.value:=$i
End if
If ($progress.isStopped)
break
End if
End for
If ($progress.isStopped)
// Do the cancellation work…
// Close after 2 sec.
$progress.Close(120)
return
End if
// Restore default values
$progress.Reset()
// Change the icon & give new messages
$progress.properties:={\
title: "Finitions"; \
message: "Just a little more patience…"; \
icon: "wait"\
}
// Giving the impression that we're doing something ;-)
DELAY PROCESS:C323(Current process:C322; 240)
// If you no longer need the progress bar,
// You can use Quit() to close the dialog and kill the worker.
$progress.Quit()