On Thu, Aug 15, 2013 at 8:13 AM, Mark Miesfeld <miesf...@gmail.com> wrote:
>
> Here is a simple example using a ProgressDialog:
>
Art,
Here is a second example using a ProgressDialog. It is exactly like the
first example, except it steps the progress bar rather than using marquee
mode. The only changes are in the longTask() method.
Typically you use marquee mode when you want to show that your application
is not hung, is making progress, but your long task is not easily broken up
into distinct increments.
In my example, we are using a set number of loops, so it is easy to break
the task into distinct increments.
/* Example using the ProgressDialog class, longTaskStep.rex */
.application~setDefaults('O', , .false)
.constDir['IDC_PB_FAKE1'] = 100
.constDir['IDC_PB_FAKE2'] = 101
.constDir['IDC_PB_FAKE3'] = 102
.constDir['IDC_PB_QUERY'] = 103
dlg = .SQLQueryDialog~new
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)
::requires "ooDialog.cls"
::class 'SQLQueryDialog' subclass UserDialog
::method init
forward class (super) continue
self~create(30, 30, 257, 123, "Execute SQL Dialog", "CENTER")
::method defineDialog
self~createPushButton(IDC_PB_FAKE1, 10, 10, 50, 14, "", "Fake One")
self~createPushButton(IDC_PB_FAKE2, 70, 10, 50, 14, "", "Fake Two")
self~createPushButton(IDC_PB_FAKE3, 10, 35, 50, 14, "", "Fake Three")
self~createPushButton(IDC_PB_QUERY, 10, 60, 50, 14, "", "SQL Query",
execSQL)
self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")
self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")
::method execSQL unguarded
self~start(longTask)
return 0
::method longTask unguarded
count = 1000
step = 10
msg = 'Executing an imaginary long-running task. This will take some
time.'
pbDlg = .ProgressDialog~new( , msg, 0, count, step)
pbDlg~canCancel = .true
a = .Alerter~new
pbDlg~setInterruptible(a)
self~disable
pbDlg~begin
pbDlg~updateStatus('0 loops executed')
do i = 1 to count
j = SysSleep(.1)
if i // step = 0 then do
pbDlg~increase
pbDlg~updateStatus(i 'loops executed')
end
if a~isCanceled then do
pbDlg~updateStatus('canceled after' i 'loops executed')
r = SysSleep(1.5)
leave
end
end
pbDlg~endNow
self~enable
--
Mark Miesfeld
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users