Looking for simple NSCursor example code
Looking for simple NSCursor example code
- Subject: Looking for simple NSCursor example code
- From: Antoine McNamara <email@hidden>
- Date: Fri, 02 Aug 2002 15:21:53 -0700
I'm having problems getting extremely simple NSCursor code using a
cursorRect in a view to work as described in the documentation. All the
examples I can find that change the cursor do so by calling
setDocumentCursor instead of the using a cursorRect.
I need my app to display a custom cursor when the mouse lies above a
particular view. The documentation is clear on how this should be
accomplished, but I can't get even the most brain-dead program to
actually get it to switch.
Here's the stripped down code, using the IBeamCursor instead of my
custom one:
@interface CursorView : NSView {}
@end
@implementation CursorView
- (id)initWithFrame:(NSRect)frame {
return [super initWithFrame:frame];
}
- (BOOL)acceptsFirstResponder {
return YES;
}
- (void)awakeFromNib
{
NSCursor *aCursor = [NSCursor IBeamCursor];
[self addCursorRect:[self bounds] cursor:aCursor];
[aCursor setOnMouseEntered:YES];
}
- (void)drawRect:(NSRect)rect {
[[NSColor blueColor] set];
NSRectFill(rect);
}
@end
Does anyone have any idea what I'm doing wrong? Or a link to some
sample code that successfully uses a cursorRect?
Antoine McNamara - email@hidden
Pixar Animation Studios
_______________________________________________
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.