I’ve got a webapp, which sometimes depending on user-entries, has a lot of work to do.
I want to show a loading-indicator, to avoid that the users clicks several times on the button because nothing happens at first.
Because my app is very huge and has over 100 menus, I don’t want to add this functionality to every button and function by my self. Instead I search for a global solution.
So my question is:
Can I show a loading-indicator (intermediate progressbar, progress-wheel, etc.) to my webpage, if there is an operation in the app. I don’t want use threads
If you put the ProgressBar on a modal dialog, that will prevent multiple clicks. That said, I do not quite see how you could push the progressBar without using a timer.
Unless, and this is just a wild idea, you emulate the progressBar with a WebAnimator ?
I’ve got a webapp, which sometimes depending on user-entries, has a lot of work to do.
I want to show a loading-indicator, to avoid that the users clicks several times on the button because nothing happens at first.
Because my app is very huge and has over 100 menus, I don’t want to add this functionality to every button and function by my self. Instead I search for a global solution.
So my question is:
Can I show a loading-indicator (intermediate progressbar, progress-wheel, etc.) to my webpage, if there is an operation in the app. I don’t want use threads
thanks
Lars[/quote]
First of all, take a look at the AutoDisable property that we recently added to WebButton. That should help with your extra clicking problem.
As far as showing some sort of progress while an operation happens, you’re kinda stuck with threads or a timer. That’s the only way to push a command to a browser while something else happens in the background.
To make it more global, make a subclass of WebDialog with a progress bar and possibly a cancel button, and then create them in code:
[code]// Set up the dialog
ProgDlg = new MyProgressDialog
ProgDlg.Show
// now start the long running process
…
[/code]
This assumes you also have a global property ProgDlg as MyProgressDialog. Heck, you could just wrap that into a pair of methods, one for showing and one for closing the dialog
doProcesses() is a helper method that takes in an array of blank method delegates and passes them to a new webdialog:
Sub DoProcesses(ParamArray Processes() as WDProcessing.BlankDelegate)
Session.Pause = true
dim wd as new WDProcessing
wd.Processes = Processes
wd.Show
End Sub
The WDProcessing does this in the open event
Session.Pause = True
try
Process
for i as integer = 0 to Processes.Ubound
try
Processes(i).invoke
Catch
end
next
catch
end
Close
session.pause = False
I sometimes use a Session.Pause boolean to prevent other actions from occuring. This prevents extra clicking. In the start of the method I do
Why not subclass the webbutton so it calls the modalDialog when clicked, add a new Action event definition so it works as usual, and make it super for all the buttons ? That will save a few lines of code for every button and possible errors.