Hi,

I am trying to follow the app out of chapter 15 of Cocoa Applications, a 
step-by-step guide, with example code at:

Examples

My BarView.m follows:

#import "BarView.h"

@implementation BarView

- (IBAction)takePercentage:(id)sender
{
    [self setPercentage:[sender floatValue] ];
}

/* designated initializer */
- initWithFrame:(NSRect)r
{
    self = [super initWithFrame:r];
        if (self) {
                [self setBoundsSize:NSMakeSize(100.0,1.0)];
        }
    return self;
}

- (BOOL)isOpaque
{
    return YES;
}

- (void)drawRect:(NSRect)aRect
{
    [[NSColor blackColor] set];
    NSRectFill(NSMakeRect(0,0,percentage,1));
        
    NSDrawWindowBackground(
                                                   
NSMakeRect(percentage,0,100-percentage,1));
}

- (void)setPercentage:(float)val
{
    percentage = val;
    [self setNeedsDisplay:YES];
}

@end

Unfortunately, the app won't run. Moving the slider does not produce the image 
in the window.

Source code that I've completed can be downloaded at:

msemac.redwoods.edu/~darnold/junk/BarViewApp.zip

Can anyone give me some pointers to help get this running as designed?

Thanks,

David Arnold
College of the Redwoods


        _______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to