Hello Luca,Take a look at the sample on the Web site here: http://www.west-wind.com/wconnect/webcontrols/progressBar.wcsx
This sample uses Ajax callbacks to provide what it seems you are wanting. Go to the bottom of the page and use the Show WCSX button and the Show PRG button to see the code in both the Web Page and the Code Behind page.
Perhaps this will help some...
Marty
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. Can I increment Progress_counter out of UpdateProgress_Callback function?
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()
Session.SetSessionVar("Progress_Counter","0")
RETURN
ENDFUNC
************************************************************************************************************
FUNCTION UpdateProgress_Callback(llCancel)
lnCounter = VAL( Session.GetSessionVar("Progress_Counter") )
LOCAL loArgs as ProgressEventArgs
loArgs = CREATEOBJECT("ProgressEventArgs")
*** so we have to parse 'true'
IF llCancel
loArgs.Cancelled = .T.
loArgs.Percent = lnCounter
RETURN loArgs
ENDIF
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
![]()