That's what the example is for in the samples. It does exactly what you're asking.
More info is in the help file:
wcdocs:_1vl1d3ux3.htm
+++ Rick ---
Dear Rick,
please could you make an example of using ProgressBar in long procedure?
I do not understand if/how I have to put my long procedure into UpdateProgress_Callback, or if/how I have to call UpdateProgress_Callback from external long procedure.
Thank you very much for patience.
Dear Rick,
I am studying your ProgressBar, but there is something I do not understand.
I have a long procedure in the Ok_click function. In this example I simulate operations with a FOR ENDFOR cycle, I run UpdateProgress 100 times while usually I would run UpdateProgress just one time for every block of long operations, so I could have about 10 runs of UpdateProgress tipically. However in this example I see the Progress on webpage showing "Waiting to get started", while I see Progress_counter incremented rightly in Session.oData.Vars.
Please what is wrong?
***************************************************************** DEFINE CLASS test_Page as WWC_WEBPAGE OF WWC_WEBPAGE_FILE ***************************************************************** EnableSessionState = .T. FUNCTION Ok_click() this.Startprocessing_callback FOR m.counter=1 TO 100 Session.SetSessionVar("Progress_Counter",TRANSFORM(m.counter)) ENDFOR this.Processcomplete_callback ENDFUNC ************************************************************************************************************ FUNCTION StartProcessing_Callback() *** Create a counter we can increment and store in Session Session.SetSessionVar("Progress_Counter","0") RETURN ENDFUNC ************************************************************************************************************ FUNCTION UpdateProgress_Callback(llCancel) lnCounter = VAL( Session.GetSessionVar("Progress_Counter") ) LOCAL loArgs as ProgressEventArgs loArgs = CREATEOBJECT("ProgressEventArgs") *** Parameters come back as literal strings only *** so we have to parse 'true' IF llCancel loArgs.Cancelled = .T. loArgs.Percent = lnCounter RETURN loArgs ENDIF *** Completed IF lnCounter >= 100 loArgs.Completed = .T. loArgs.Percent = 100 RETURN loArgs ENDIF loArgs.Percent = lnCounter RETURN loArgs ************************************************************************************************************ FUNCTION ProcessComplete_Callback() RETURN .T. ENDFUNC ENDDEFINE
Thank you very much
You can use the ProgressBar control that comes with the Web Control Framework:
http://www.west-wind.com/wconnect/webcontrols/progressBar.wcsx
in combination with a Modal Popup window...
http://www.west-wind.com/wconnect/webcontrols/ModalPopup.wcsx
+++ Rick ---
Does anybody know of a way to display a modal progress window? I don’t know anything about client-side scripting and can’t find any examples on the web that will work in a webconnect page.
The problem is that users get impatient while waiting for the postback from the server and create duplicate transactions. So I was thinking that I could lock the screen with an opaque modal window for a few seconds to give time for the transaction to process. The demo examples appear to display the modal dialog _after_ the postback, so that doesn’t help.
Thanks in advance,
Mark
West Wind Technologies
Making waves on the Web
from Maui, Hawaii