NSProgressIndicator
NSProgressIndicator
- Subject: NSProgressIndicator
- From: "John Love" <email@hidden>
- Date: Fri, 23 May 2008 07:30:39 -0400
I have successfully been able to create a small project whose GUI consists
of a NSProgressIndicator, or wheel, and a Button, titled "Spin". In the .nib
window, the "Controller" is ctrl-dragged to the wheel, specifying an outlet
"wheel" and the Button is ctrl-dragged to the Controller, specifying an
action :spin:".
Within the Controller.h file, I have:
@interface Controller:NSObject {
IBOutlet NSProgressIndicator *spinner;
BOOL start;
}
- (IBAction) spin:(id)sender;
Within the Controller.m file, I have:
@implementation Controller
- (id) init {
if (self = [super init]) {
spinner = [[[NSProgressIndicator alloc] init] autorelease];
start = TRUE;
}
return self;
}
- (void) awakeFromNib {
// [theIndicator setStyle:NSProgressIndicatorSpinningStyle]; // already
there
[spinner setUsesThreadedAnimation:YES];
}
- (IBAction) spin:(id)sender {
if (start) [spinner startAnimation:nil];
else [spinner stopAnimation:nil];
start = !start;
}
@end
==========
Works like a champ .. pressing the Button starts, stops the spinning like it
should.
NOW .. another "speed bump" .. how to control the spinning from other
objects, i.e., no IBAction .. so, remove the Button.
Changing the spin method to look like:
- (void) spinIt:(BOOL)begin {
if (begin) [spinner startAnimation:nil];
else [spinner stopAnimation:nil];
}
Here is what I've tried, to no success:
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden