Re: scribbling
Re: scribbling
- Subject: Re: scribbling
- From: Richard Chamberlain <email@hidden>
- Date: Wed, 13 Aug 2003 15:35:18 +0100
Thanks Alastair,
On Wednesday, August 13, 2003, at 02:48 pm, Alastair J.Houghton wrote:
On Wednesday, August 13, 2003, at 12:45 pm, Richard Chamberlain wrote:
I tried drawing in the mouseDragged method but that doesn't seem to
work.
This should work, but only if you remembered to do [self lockFocus]
and [self unlockFocus] around your drawing. (Assuming, that is, that
you're drawing in the view that received the -mouseDragged: message.)
Sorry I hadn't noticed those methods. So I've got this:
- (void)mouseDragged:(NSEvent *)event
{
NSPoint currentPoint = [self convertPoint:[event locationInWindow]
fromView:nil];
NSBezierPath* path = [[NSBezierPath alloc] init];
[self lockFocus];
[[NSColor redColor] set];
[path setLineWidth: 2.0];
[path moveToPoint:lastPoint];
[path lineToPoint: currentPoint];
[path closePath];
[path stroke];
[self unlockFocus];
[lines addObject:path];
[path release];
lastPoint = currentPoint;
}
and it doesn't work :-(
Eventually the scribbles appear but not straight away for some reason.
I set the drawRect code to use a different colour so I can see what is
being drawn where and red lines do appear.
Any suggestions?
I'll try the bounds suggestion as well but I would like to understand
why this doesn't work.
Thanks again,
Richard
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Re: scribbling (From: "Alastair J.Houghton" <email@hidden>) |