Re: drawRect not getting called when needed under OS X
Re: drawRect not getting called when needed under OS X
- Subject: Re: drawRect not getting called when needed under OS X
- From: Tom Jeffries <email@hidden>
- Date: Sat, 23 Jul 2011 21:33:24 -0700
Graham, I'm not calling drawRect. The button click goes to another module
in the program, all the code in that module works fine, then it calls the
module that has the NSView, executes the code for creating all the lines and
shapes, and then tries to get the new graphics to display. I've tried
(among other things):
[super setNeedsDisplay : YES];
[SequeraStepWindow setNeedsDisplay : YES];
[self setNeedsDisplay : YES];
[SequeraStepWindow display];
[self display];
[super display];
When I run the code that displays the graphics in question on initialization
it works fine, but when I call it later in the program it the new graphics
are not displayed. The code in the graphics module that displays the window
is working perfectly, but somehow drawRect never gets called after it is
called during initialization.
On Sat, Jul 23, 2011 at 9:06 PM, Graham Cox <email@hidden> wrote:
>
> On 24/07/2011, at 1:46 PM, Tom Jeffries wrote:
>
> When I put both the beginning graphics and the graphics that are to be
> drawn
> later in the initial drawRect call everything is drawn without a problem.
> However, drawRect does not get called when the user clicks the button on
> the
> second window. I've tried awakeFromNib, setNeedsDisplay, needsDisplay, and
> display, but nothing I've found so far gets the NSView window to call
> drawRect.
>
> I am fairly new to OS X programming and appreciate any hints you can throw
> my way.
>
>
>
> Show your code.
>
> You don't call drawRect: - the framework does. You can tell the framework
> it needs to be called by calling the view's -setNeedsDisplay: method. Are
> you doing that?
>
> How does the button come into it? How are you responding to the button?
> That's the trouble - what you've said so far is far too vague, it could be a
> thousand different things (but probably something simple).
>
> --Graham
>
>
>
_______________________________________________
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