FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ProgressBar help needed...

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Sun Jan 06, 2008 4:16 pm    Post subject: ProgressBar help needed... Reply with quote

Greetings.

I have created these functions,
Code:
  private void DisplayProgressBar(char[] code)
  {
    //msgBox(code);
    if(code == "stop")
    {
      tmr.stop();
      tmr = null;
      //if(pBar.value == pBar.maximum)
      pBar.value = pBar.minimum;
    }
    else if(code == "start")
    {
      pBar.value = 0;
      pBar.minimum = 0;
      pBar.maximum = 50;
      pBar.step = 1;
      tmr = new Timer;
      tmr.interval = 100;
      tmr.tick ~= &tmr_tick;
      tmr.start();
    }
  }
 
  private void tmr_tick(Object sender, EventArgs ea)
  {
    pBar.performStep();
    if(pBar.value == pBar.maximum)
      pBar.value = pBar.minimum;
  }


and when I place these calls inside some functions, as in,
Code:

private void foo()
{
  DisplayProgressBar("start");
  // some more code here that takes longer than the timer interval
  DisplayProgressBar("stop");
}


Though the time to execute foo takes longer than tmr.interval, pBar progress is never executed. But, if I put a msgBox just before the stop call, it displays the progress bar.

This may be because I may not know what the Timer class does.

Any help would be greatly appreciated.

thanks,

jic
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Mon Jan 07, 2008 1:30 pm    Post subject: Re: ProgressBar help needed... Reply with quote

The timers don't use threads, they're just ordinary DFL events. So if you don't return from your events or use doEvents (in a timely fashion), the timer events can't happen. It's similar to the previous problem you had when your GUI wouldn't show changes.
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Tue Jan 08, 2008 10:22 pm    Post subject: Reply with quote

Thanks, Chris.

jose
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

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


Powered by phpBB © 2001, 2005 phpBB Group