i hadn't tried setNeedsDisplay:YES... but this works... and now i know what setNeedsDisplay means, which is exciting :)
thanks everyone. On Tue, Dec 9, 2008 at 11:27 AM, rajesh <[EMAIL PROTECTED]> wrote: > > On Dec 9, 2008, at 5:17 PM, Chunk 1978 wrote: > >> i'm assuming this is simple, but i can't solve the problem. at launch >> of the application, an NSRect is drawn with a userdefault color: >> >> -=-=-=-=- >> - (void)drawRect:(NSRect)rect >> { >> NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; >> NSData *colorAsData; >> colorAsData = [defaults objectForKey:@"aColor"]; >> NSColor *menuBarColor = [NSKeyedUnarchiver >> unarchiveObjectWithData:colorAsData]; >> [menuBarColor set]; >> NSRectFill([self bounds]); >> } >> -=-=-=-=- >> >> that works... but now i want that rect to redraw itself when notified >> to do so, but i can't figure out how to notify the NSRect to draw >> again... all my NSUserDefaults colorAsData is in place, as well as my >> NSNotifications. it will print to NSLog so i know that notification >> is being called, but how do direct that notification to the drawRect >> method? >> >> -=-=-=-=- >> - (void)awakeFromNib >> { >> [MenuBarWindow setAlphaValue:0.0]; >> >> NSNotificationCenter *notificationCenter = [NSNotificationCenter >> defaultCenter]; >> NSString *changeColorNotification = @"changeColorNotification"; >> [notificationCenter addObserver:self >> selector:@selector(changeColor:) >> changeColorNotification object:nil]; >> } >> >> - (void)changeColor:(NSNotification *)notification >> { >> NSLog(@"Call drawRect"); >> //call "drawRect:(NSRect)rect" method > > Let me cover the obvious part....... ( just to see that no stone is unturned > ) > > you mean , even after when you tried [self setNeedsDisplay:YES] ???? > I guess you know that , you are not supposed to invoke the drawRect directly > ...... > > Are you sure this what you wanted ? or I didn't get the tone of obvious > tricky question ?? > > >> >> } >> -=-=-=-=- >> _______________________________________________ >> >> 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/rajesh%40vangennep.nl >> >> This email sent to [EMAIL PROTECTED] > > _______________________________________________ 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 [EMAIL PROTECTED]