Have been making the effort in the last few days to learn objective-c and how to use cocoa and x-code.
Was making this program that simply had the user enter a starting number, an increment number and an ending number which would be used in a for loop.
Inside the for loop would have code to update a determinate progress indicator to show how close to finishing the looping it was.
For the life of me and my embarrassment I cannot get this to work. I have looked over it countless times and looked at documentation.
Here is my code:
When I run the program and start the loop (through a button action which invokes a method that calls another method with this loop in it) the indicator does not move at all. Yet I have tested with printf's to the console and the loop is working (just not the indicator!)
Any help is greatly appreciated!
Was making this program that simply had the user enter a starting number, an increment number and an ending number which would be used in a for loop.
Inside the for loop would have code to update a determinate progress indicator to show how close to finishing the looping it was.
For the life of me and my embarrassment I cannot get this to work. I have looked over it countless times and looked at documentation.
Here is my code:
Code:
-(void)benchmark
{
int i;
//Set the progress bar's minimum value to the start number.
[progressBar setMinValue:self.startNumber];
//Set the progress bar's maximum value to the end number.
[progressBar setMaxValue:self.endNumber];
//Increment the progress bar by the incremental value.
[progressBar incrementBy:self.incrementNumber];
for (i = self.startNumber; i <= self.endNumber; i = i + self.incrementNumber)
{
//Advance the progress bar to what "i" currently is at.
[progressBar setDoubleValue:i];
//Force the progress bar visual to update immiediately.
[progressBar displayIfNeeded];
}
}
@end
When I run the program and start the loop (through a button action which invokes a method that calls another method with this loop in it) the indicator does not move at all. Yet I have tested with printf's to the console and the loop is working (just not the indicator!)
Any help is greatly appreciated!