• 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
Drawing when app is in active
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing when app is in active


  • Subject: Drawing when app is in active
  • From: Jonathan Guy <email@hidden>
  • Date: Sat, 24 Mar 2012 10:30:40 +0000

Hi all
This is must be the most simple a puzzling problem I've had. Take a new app, create a custom view class with a drawrect of

- (void)drawRect:(NSRect)dirtyRect
{
    if ([NSApp isActive]) {
		[[NSColor redColor] set];
	}
	else {
		[[NSColor blueColor] set];
	}
	NSRectFill([self bounds]);
}

pretty simple stuff you would think but if I drop this custom view onto the main window and run it up the view draw a blue square??? how bizarre. If I resize the window it suddenly draws red but deactivating a reactivating the app is not redrawing the view with the correct color. What is going on here? I can only think the whole view is being clipped as the system doesn't think it needs to be redrawn as the very first drawrect the app is showing as inactive but then subsequently drawrect  gets called again with the app in an active state so it initially draws blue but then is supposed to draw red but that's not happening.
	Any help would be appreciated.
Thanks
_______________________________________________

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

  • Prev by Date: Re: drawing lines in and NSTextView
  • Next by Date: Re: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
  • Previous by thread: Re: Stenography
  • Index(es):
    • Date
    • Thread