Welcome Guest Search | Active Topics | Sign In | Register

Progress Bar - Questionable behaviour Options
Dysanovic
Posted: Wednesday, September 26, 2007 9:38:11 AM
Rank: Newbie
Groups: Member

Joined: 9/26/2007
Posts: 2
Hi,

I'm using the progress bar with the following server side code:

Code: C#
protected void ProgressBar1_RunTask(object sender, EO.Web.ProgressTaskEventArgs e)
{
      for (int i = 1; i <= 100; i++)
      {
        //Check whether the task has been stopped
        if (e.IsStopped)
        {
          e.UpdateProgress(0);

          break;
        }

        //Perform some work
        System.Threading.Thread.Sleep(10);

        //Update client side progress
        e.UpdateProgress(i);
      }
}


The first problem I've noticed is if you run this code with the "ControlSkinID" set to "Windows_Vista" the completion completion bar goes to 100% on completion. However if you then change the ControlSkinID to "Windows_XP" and run the code, the completion bar does not go to 100%. Is this as desgned?!

Also when a user stops the progress bar by making use of a defined StopDemoButton I'd like to reset the bar to zero. I hoped the code I had in the "if (e.IsStopped)" would do the job but it does not. How can I reset the bar when I click stop?

Aside from these issues I'd like to say that you've a great package of controls and I'm doing some good word of mouth for you!
eo_support
Posted: Wednesday, September 26, 2007 10:08:33 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Thanks for spreading the word! We tried "Windows_Vista" at here and it seems to work fine. Make sure that you use a fixed pixel width for the progress bar.

We've had different request regarding what the progress bar should do when user stops it. Some wanted us to reset it, and some didn't want to do anything, so we decided to not to do anything first. e.IsStopped only reads the value but does not change it. As for now, the only way to reset it when user stops is by override the progress bar's stopTask method:

Code: JavaScript
//ClientSideOnValueChanged handler
function OnProgressBarValueChanged(progressBar)
{
    if (progressBar.oldStopTask == null)
    {
        //Replace stopTask method with our own
        progressBar.oldStopTask = progressBar.stopTask;
        progressBar.stopTask = NewStopTask;
    }
}

//This is our own stopTask method. It takes one parameter,
//so here we make sure this parameter is passed to the
//original handler
function NewStopTask(reserved)
{
    //Call the original handler
    this.oldStopTask(reserved);

    //Reset the progress bar value
    this.setValue(0);
}

That should give you the desired result.

Thanks
Dysanovic
Posted: Thursday, September 27, 2007 2:27:14 AM
Rank: Newbie
Groups: Member

Joined: 9/26/2007
Posts: 2
Hi,

The ClientSideOnValueChanged handler code you posted is exactly what I wanted. The only issue I have is that there does not seem to be any documentation indicating accessible properties when using the Javascript i.e where is progressBar.oldStopTask doxumented?

As for the "fixed pixel width for the Progress bar", I set the "IndicatorIncrement" property to "1" and now both styles of progress bar are working as expected (i.e. they both show 100% completion).

Cheers for the blisteringly fast response and keep up the great work.

D
eo_support
Posted: Thursday, September 27, 2007 7:11:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

oldStopTask is not from us. It's just a variable that we put in the sample code to save the original implementation of stopTask. You can use any variable name for that.

Glad to know that you worked out the IndicatorIncrement thing!

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.