• 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: setNeedsDisplayInRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setNeedsDisplayInRect


  • Subject: Re: setNeedsDisplayInRect
  • From: Benjohn <email@hidden>
  • Date: Mon, 22 Nov 2004 17:33:02 +0000


On 30 Jul 2004, at 22:33, email@hidden wrote:

Hello,

In my custom view, I make use of (what I thought to be anyway)
selectively drawing certain content depending on the rectangle passed
in via NSView's "drawRect:"  method.  However, after some testing, I
have determined that two calls to "setNeedsDisplayInRect:", when they
are close by in execution sequence, only the second one goes through.

Expected behavior would have been either to: (Let X be call 1's
rectangle and Y be call 2's)

1) Call drawRect:X  and then drawRect:Y
2) Z = NSUnionRect(X,Y) and then drawRect:Z

Instead the framework is simply calling drawRect:Y, leaving a lot of
area in my view unupdated.

So, the questions are -- A) Why does it not choose options 1 or 2
above? and B) Did I waste my time checking rectangle intersections in
drawRect to selectively draw portions of my view?

Thanks,
Rick Bischoff

Did you sort out a satisfactory solution in the end, or come to a further understanding of the situation?


I seem to be having this problem too. At least: it seems that some of the calls I make to this method are ignored, while others are not. There was a reply to this post, but the documentation it helpfully pointed too didn't enlighten me any further.

In our application, we're sending the "setNeedsDisplayInRect:" calls from a thread other than the main thread (the main thread being responsible for actually painting updates in our case). I wondered if the problem could be due to a race condition between the two threads? I'm pretty sure I remember reading some Apple documentation indicating that while parts of the AppKit and Foundation are not thread safe, "setNeedsDisplayInRect:" is. I don't recall where I read this though :(

Thanks, for any pointers or otherwise
	Benjohn Barnes

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: How to disable/gray an NSTextfield (used as static text)
  • Next by Date: Re: NSDocument beginSheet on a new document
  • Previous by thread: Re: Prevent space characters in a NSTextField
  • Next by thread: Class name
  • Index(es):
    • Date
    • Thread