Skip navigation.
 
mlprogress bar question
FROM : Ryan Bartig
DATE : Sat Nov 16 21:27:56 2002

I created a small simple project with a button and a progress bar.  I
subclassed NSObject then added an action and a outlet.  I then instantiated
the new class and control dragged from the object to the progress bar to
connect to create the connect for the outlet.  Then I control dragged from
the button to the object to connect it to the action.  After that I created
the two files (.h  & .m) in the project.  When I click the button nothing
happens and am totally lost.  Attached below is the code, any help would be
greatly appreciated.  Thanks in advance.

/* progress_bar (.h file) */

#import <Cocoa/Cocoa.h>

@interface progress_bar : NSObject
{
    IBOutlet id progressView;
    NSTimer *timer;
}
- (IBAction)pushedButton:(id)sender;
@end

// beginning of .m file
#import "progress_bar.h"

@implementation progress_bar

- (void)awakeFromNib
{
   srandom(time(NULL));
}

- (IBAction)pushedButton:(id)sender
{
   if([sender state] == 1)
   {
       NSLog(@"Starting");

       timer = [[NSTimer scheduledTimerWithTimeInterval:0.2 target:self
selector:@selector(checkTime:) userInfo:nil repeats:YES] retain];

   } else {
       NSLog(@"Stopping");

       [timer invalidate];
       [timer release];
   }
}

- (void) checkTime: (NSTimer *) aTimer
{
   NSLog(@"check");
   [progressView incrementBy:10];
}

@end

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
No related mails found.