FROM : Warwick Hall
DATE : Tue Dec 31 20:51:01 2002
Happy New Years to all.
Question:
I have a NSView subclass (Objective-C) that listens
for mouse enter and exit events. When the mouse enters
I need to create a NSTimer that draws patterns around
the NSView. On exit the NSTimer is invalidated.
The NSTimer calls a message pattern: and this seems to
work. Here is the general code:
// Part of my NSView subclass...
- (void) pattern : (id) userInfo
{
NSBezierPath* path;
if(![self lockFocusIfCanDraw])
return;
path = [[NSBezierPath alloc] init];
// Do drawing stuff here, mainly
// with NSBezierPath moveToPoint
// and lineToPoint calls...
[[NSColor redColor] set];
[path fill];
[path release];
[self unlockFocus];
}
And nothing happens to the view.
* I have tested that [self canDraw] returns YES.
* [self lockFocus] does not improve anything.
* using NSLog() calls I know the NSTimer is calling
repeatedly the pattern: message (as it should).
unsure what to do now.
Happy Holies,
wh
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
DATE : Tue Dec 31 20:51:01 2002
Happy New Years to all.
Question:
I have a NSView subclass (Objective-C) that listens
for mouse enter and exit events. When the mouse enters
I need to create a NSTimer that draws patterns around
the NSView. On exit the NSTimer is invalidated.
The NSTimer calls a message pattern: and this seems to
work. Here is the general code:
// Part of my NSView subclass...
- (void) pattern : (id) userInfo
{
NSBezierPath* path;
if(![self lockFocusIfCanDraw])
return;
path = [[NSBezierPath alloc] init];
// Do drawing stuff here, mainly
// with NSBezierPath moveToPoint
// and lineToPoint calls...
[[NSColor redColor] set];
[path fill];
[path release];
[self unlockFocus];
}
And nothing happens to the view.
* I have tested that [self canDraw] returns YES.
* [self lockFocus] does not improve anything.
* using NSLog() calls I know the NSTimer is calling
repeatedly the pattern: message (as it should).
unsure what to do now.
Happy Holies,
wh
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
| Related mails | Author | Date |
|---|---|---|
| Warwick Hall | Dec 31, 20:51 | |
| Shaun Wexler | Jan 1, 07:33 |






Cocoa mail archive

