 |
 |
definite progress bar in seconds?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Feb 2001
Location: Amstelveen, Netherlands
Status:
Offline
|
|
Hello,
I want to create a definite progress bar in my program (if itīs possible even more that can run at the same time).
I want to use a definite progress bar but I want to count of a certain amount of seconds. For instance I want one bar to count 45 seconds and another 30 seconds. But in such a way that they donīt lock up the application.
I checked the documentation on progress bars but couldnīt find any more then it counts from 0 to 100 in incremental steps and that the bar is updated each time it passes the main event loop. But I think that doesnīt really garantee that it times off to 45 clock seconds.
So if someone can help me with this, any example code would be perfect,
that is greatly appreciated.
Is it possible to create a bar and give your own window title to it?
Thanks anyone who can provide some more information.
Regards
Merijn
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status:
Offline
|
|
That's not too hard. You just have to keep track of the time yourself. So when you first start your progress bar do something like:
NSDate *startTime = [NSDate date];
double currentProgressTime = 0;
in order to store the date. Keep that variable around and then instead of having the thing updated automagically when it passes thought the event loop, call something each time through the event loop that is like:
if(45 - (currentProgressTime = [startTime timeIntervalSinceNow]) >= 0)
[yourProgressBar incrementBy:currentProgressTime*100/45 - [yourProgressBar doubleValue]];
else
// set the progress bar at 100, remove whatever is calling this from the run loop and release startTime.
That's it.
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
|
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Feb 2001
Location: Amstelveen, Netherlands
Status:
Offline
|
|
to paralax: in cocoa.
I decided to skip carbon and go for cocoa right away.
Thanks Dalgo for how to deal with the timing.
Today I also tried making a progress bar in interface builder. However I was unable to get the button to start the bar.
I am wondering how I can get a button in one window to open a new window and put then the bar inside that.
So now that the time problem is solved (I'm fairly new to objective C) I still have to work out exactly how to put in all the suggestions.
(off topic comment)
Dalgo, it may be not too hard for you, but I have to admit that it will be hard for me (still). However I have a strong will to learn ObjC in Cocoa and I know I can learn it.
Please bear a little patience with me.
I probably will be back with another question in the future.
Anyway, thanks
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |