View previous topic :: View next topic |
Author |
Message |
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Sun Jan 06, 2008 4:16 pm Post subject: ProgressBar help needed... |
|
|
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 |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Jan 07, 2008 1:30 pm Post subject: Re: ProgressBar help needed... |
|
|
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 |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Tue Jan 08, 2008 10:22 pm Post subject: |
|
|
Thanks, Chris.
jose |
|
Back to top |
|
|
|
|
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
|