Re: Drawing in a NSView out side of drawRect

2008-12-23 Thread Michael Ash
On Tue, Dec 23, 2008 at 12:44 PM, David Alter wrote: > Thanks to everyone that has responded to me. It has been a big help. > >> > I want to draw in a NSView but not when drawRect is called. >> >> Others have pointed this out, but I want to reiterate: no you don't. >> Trying to draw outside of dra

Re: Drawing in a NSView out side of drawRect

2008-12-23 Thread David Alter
Thanks to everyone that has responded to me. It has been a big help. > > I want to draw in a NSView but not when drawRect is called. > > Others have pointed this out, but I want to reiterate: no you don't. > Trying to draw outside of drawRect: will only lead to pain. (It is > useful, on rare occa

Re: Drawing in a NSView out side of drawRect

2008-12-22 Thread Michael Ash
On Mon, Dec 22, 2008 at 4:22 PM, David Alter wrote: >> > CGContextRef myContext = >> > (CGContextRef)[[NSGraphicsContext currentContext]graphicsPort]; >> >> Right now you're getting the current graphics context, which is purely >> arbitrary. Nothing has set it yet, so you're getting whatever h

Re: Drawing in a NSView out side of drawRect

2008-12-22 Thread David Alter
> > > CGContextRef myContext = > > (CGContextRef)[[NSGraphicsContext currentContext]graphicsPort]; > > Right now you're getting the current graphics context, which is purely > arbitrary. Nothing has set it yet, so you're getting whatever happened > to be hanging around. Is there a way to crea

Re: Drawing in a NSView out side of drawRect

2008-12-19 Thread Michael Ash
On Fri, Dec 19, 2008 at 7:20 PM, David Alter wrote: > I want to draw in a NSView but not when drawRect is called. Others have pointed this out, but I want to reiterate: no you don't. Trying to draw outside of drawRect: will only lead to pain. (It is useful, on rare occasions. You are not experien

Re: Drawing in a NSView out side of drawRect

2008-12-19 Thread Graham Cox
On 20 Dec 2008, at 11:20 am, David Alter wrote: I want to draw in a NSView but not when drawRect is called. Why? There are very few situations when this is required or appropriate. To do this I understand that I need to call lockFocus before drawing and unlockFocus after. The drawing appe

Re: Drawing in a NSView out side of drawRect

2008-12-19 Thread Ricky Sharp
On Dec 19, 2008, at 6:20 PM, David Alter wrote: I want to draw in a NSView but not when drawRect is called. To do this I understand that I need to call lockFocus before drawing and unlockFocus after. The drawing appears to happen but it is not until I deactivate the window do I see my resu

Drawing in a NSView out side of drawRect

2008-12-19 Thread David Alter
I want to draw in a NSView but not when drawRect is called. To do this I understand that I need to call lockFocus before drawing and unlockFocus after. The drawing appears to happen but it is not until I deactivate the window do I see my results. How can I get it to refresh once I have done my draw