Re: Screen not redrawing
Re: Screen not redrawing
- Subject: Re: Screen not redrawing
- From: Russ <email@hidden>
- Date: Fri, 17 Oct 2008 17:07:47 -0700 (PDT)
Sorry about the source code part, but this is an existing cross-platform commercial app being 64-bit-Cocoa-ized. It uses a portability library that was carbon and is being brought piecemeal to Cocoa. So there's like 10k lines of code for that at the moment. It's successfully building and drawing a large portion of the UI with one NSWindow and a variety of nested NSViews. I have a dump routine that shows me the nswindow/nsview hierarchy and various rects for placement. That's all good and indeed the first draw shows the right thing. When the menu items are hit, they update system state, then ask for redraws on some or all of the NSViews using setNeedsDisplay:YES. The subclassed drawRect routine causes a redraw using rectangle fills and bezierpaths and does work. The drawRect code does not use the supplied rect argument at all, draws the whole view. I can see setNeedsDisplays being called. I can single step through the code and verify what is happening
inside the drawRect calls, they just do the drawing.
As I said, I can use resizing to make portions of the window physically be redrawn and as they do, they are correct. They just do not seem to be copied to the screen itself.
So unfortunately I am indeed looking for a little magic pixie dust to sprinkle on this. Should work, doesn't, pull hair.
----- Original Message ----
From: Graham Cox <email@hidden>
To: Russ <email@hidden>
Cc: email@hidden
Sent: Friday, October 17, 2008 7:39:21 PM
Subject: Re: Screen not redrawing
On 18 Oct 2008, at 8:48 am, Russ wrote:
> My app is drawing acceptably (for now) the first time, but the
> screen isn't updating after anything happens. I am calling
> setNeedsDisplay:YES on the affected NSViews and their drawRect
> routines are getting called, but it seems the results aren't being
> composited onto the screen subsequently. If I resize the window
> smaller and larger again, the exposed portion shows the correct
> portion. Just driving it with a few menu operations for now. I have
> a subclassed NSView but it is very minimal to store a little extra
> information and pass along the drawRect.
>
> Anything else I'm missing that's needed to enable the new images to
> make it to the screen? I have a normal event loop NSApp run going,
> things would be going well if the redraws were visible. Thanks.
Are you mistaking the rect parameter to drawRect: for your view's
bounds? Common mistake, and could easily produce the symptoms you
describe.
However, if you were to actually, you know, post your code, the error
could probably be spotted instantly.
Seems quite a few people here lately enjoy the game of "twenty
questions". Enjoyable as that can be, it's possibly not the most
efficient way to get problems identified. ;-)
hth,
Graham
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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