-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathshowprogress.prg
More file actions
35 lines (24 loc) · 795 Bytes
/
showprogress.prg
File metadata and controls
35 lines (24 loc) · 795 Bytes
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
DO LOCFILE("csv.prg")
* demonstrates the use of a progress indicator during a lengthy CSV import
LOCAL CSV AS CSVProcessor
LOCAL ShowProgress AS Progressor
m.ShowProgress = CREATEOBJECT("Progressor")
m.CSV = CREATEOBJECT("CSVProcessor")
BINDEVENT(m.CSV, "ProcessStep", m.ShowProgress, "Done", 2)
* choose a lengthy csv file
m.CSV.Import(GETFILE())
BROWSE
DEFINE CLASS Progressor AS Session
AlreadyDone = -1
PROCEDURE Done (Phase AS Integer, Done AS Number, ToDo AS Number)
LOCAL NowDone AS Integer
m.NowDone = INT(m.Done / m.ToDo * 50)
IF m.NowDone != This.AlreadyDone
WAIT WINDOW TEXTMERGE("Phase <<m.Phase>>: <<PADR(REPLICATE('*', m.NowDone), 50, '-')>>") NOWAIT NOCLEAR
This.AlreadyDone = m.NowDone
ENDIF
ENDPROC
PROCEDURE Destroy
WAIT CLEAR
ENDPROC
ENDDEFINE