Re: lockFocus error

2008-10-20 Thread Graham Cox
On 21 Oct 2008, at 10:48 am, DKJ wrote: On 20 Oct, 2008, at 16:32, Graham Cox wrote: What would you expect it to do? Suppose I wanted it to draw lines in response to user input. Would I put NSBezierPath methods in drawRect: and expose the relevant properties in the subclass? To draw

Re: lockFocus error

2008-10-20 Thread DKJ
On 20 Oct, 2008, at 16:32, Graham Cox wrote: What would you expect it to do? Suppose I wanted it to draw lines in response to user input. Would I put NSBezierPath methods in drawRect: and expose the relevant properties in the subclass? ___ Coc

Re: lockFocus error

2008-10-20 Thread Graham Cox
On 21 Oct 2008, at 10:26 am, DKJ wrote: Is this a good way of going about it? I subclassed NSView and defined the properties border_colour, fill_colour, and pic. These are initialised to nil. I then implemented drawRect: like this: - (void)drawRect:(NSRect)rect { if( bord

Re: lockFocus error

2008-10-20 Thread DKJ
On 20 Oct, 2008, at 09:15, Nick Zitzmann wrote: you do all your drawing in -drawRect:, and call -setNeedsDisplay: & friends when you need to refresh part of the view. Is this a good way of going about it? I subclassed NSView and defined the properties border_colour, fill_colour, and pic. The

Re: lockFocus error

2008-10-20 Thread Graham Cox
On 21 Oct 2008, at 2:21 am, DKJ wrote: When I do this in the controller's awakeFromNib method: [theView lockFocus]; Then don't do it! stuff like -lockFocus comes into the category of "advanced techniques". 99% of Cocoa programmers will never need it. Move along now, nothing to

Re: lockFocus error

2008-10-20 Thread Nick Zitzmann
On Oct 20, 2008, at 10:09 AM, DKJ wrote: I'm just practising with views and animations. Generally, you don't call -lockFocus on a view unless you have a very good reason. As you've already found out, -lockFocus will raise exceptions if things aren't set exactly right. Instead, you do all

Re: lockFocus error

2008-10-20 Thread DKJ
On 20 Oct, 2008, at 08:59, Nick Zitzmann wrote: Out of curiosity, why are you locking focus on a view in - awakeFromNib? I'm just practising with views and animations. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Re: lockFocus error

2008-10-20 Thread Nick Zitzmann
On Oct 20, 2008, at 9:21 AM, DKJ wrote: I have a custom view in a window, set as an instance of MyView, and connected to my controller as an IBOutlet theView. When I do this in the controller's awakeFromNib method: [theView lockFocus]; Out of curiosity, why are you locking focus

lockFocus error

2008-10-20 Thread DKJ
I have a custom view in a window, set as an instance of MyView, and connected to my controller as an IBOutlet theView. When I do this in the controller's awakeFromNib method: [theView lockFocus]; I get this error: *** Assertion failure in -[MyView lockFocus], /SourceCache/AppKit/ A