PDA

View Full Version : How can the Progress Dialog be used?



Nils G. Svedmyr
10-Nov-2010, 03:59 AM
Am I missing something that should/could be set for the cSIGCJTaskDialog class - or is the class totally unsuited for showing "Work in progress..."?

The cSIGCJTaskDialog and the Progress Dialog variant looks very stylish and after looking at the Demo (the Progress Dialog button of the SigCJTaskDialogDemo.vw) I thought it might be usefull to display the Progress Dialog while doing some background work - in my case sending of SMTP e-mails and text messages (SMS).

However - and I'm not sure if I completely missed some setting of the cSIGCJTaskDialog class - it seems like the task dialog starts a new UI level, because the code execution won't continue until the cSIGCJTaskDialog is closed - thus making it kind of useless for showing any kind of "Work in progress"??

Please tell me what I'm missing here. How have the developers behind CodeJock thought that it should be used? Or is it only usable in a multi-threading programming tool?

Nils G. Svedmyr
12-Nov-2010, 09:16 AM
Does anybody have an answer to this question?

Martin
16-Nov-2010, 06:40 AM
This one's for Peter, but I'll have a look see!

Nils G. Svedmyr
3-Dec-2010, 04:58 PM
Bump..

Peter, have you had a chance to look at how this is supposed to work?

TIA.

Peter Bragg
9-Dec-2010, 10:14 AM
Hi Nils,

Right. Two things. Firstly sorry for the delayed response. Secondly, yes this control isn't great. Basically if you want to do any processing then you have to do it inside the OnTimer event of the dialog object.

If you look inside the oSigCJTaskDialog.pkg file you'll see an example. I've also just spotted that the example contains a bug! Where there is the line of code:



Send ClickButton 1


it should be



Send ClickButton eBtn_Cancel


Basically sending ClickButton simulates the clicking of a button (funnily enough) and in this case we want it to close the dialog at the end of the process. Sending the value of 1 however replicated clicking the 'OK' button which of course doesn't cancel the process by design. Ho hum.

So anyway, inside the OnTimer event you have to code your processing AND the setting/updating of the progress bar. Now, given that you want the progress bar to update regularly this means that if you want to, for example, process 100 database records then you really need to simply process one at a time inside the OnTimer and set a property so that the next time it is called you can remember where you got to. So something like:



Move True to bResetCounter
Clear OrderHea
Get piLastOrderHeaderProcessed to OrderHea.Order_Number
Find GT OrderHea.Order_Number
If (Found) Begin
Set piLastOrderHeaderProcessed to OrderHea.Order_Number
// Do something with this record
// update the progress bar (set piProgressBarPos)
// etc
End
Else Begin
Send ClickButton 1
End


So as I say - not great. But that's the only way you can use it.

Peter Bragg
9-Dec-2010, 10:16 AM
Ha! And I've done it again! I mean of course "Send ClickButton eBtn_Cancel" (Doh!)

Michael Mullan
9-Dec-2010, 10:24 AM
you know you can just quietly go back and edit your own earlier posts....

Garret Mott
9-Dec-2010, 10:29 AM
That's way less fun for the rest of us!

Nils G. Svedmyr
9-Dec-2010, 02:15 PM
Thanks Peter for getting back to me and for explaining how the Process dialog can be used. :)

-Cheers.