• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: BarView won't run
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BarView won't run


  • Subject: Re: BarView won't run
  • From: Reinhard Segeler <email@hidden>
  • Date: Tue, 18 May 2010 09:08:33 +0200

I've checked your project  with 10.5.

I have deleted the class Bar View in IB, you don't need it there.

Connected the slider to the action-method of the BarView-view in the window.

There is no protocol <NSApplicationDelegate> so I commented it out, maybe it's defferent in 10.6

In IB I disconnected all broken connections, shown in yellow color in the info window of First Responder, even though it should not influence your app, because they weren't used anywhere.

-- Reinhard	

Am 17.05.2010 um 21:54 schrieb David Arnold:

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 (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

_______________________________________________

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


References: 
 >BarView won't run (From: David Arnold <email@hidden>)

  • Prev by Date: Re: Project Builder Files -> XCode
  • Next by Date: Re: Style Advice for using NSEnumerator
  • Previous by thread: BarView won't run
  • Next by thread: Specify "Sent Action on" Behavior of NSTextField
  • Index(es):
    • Date
    • Thread