• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Looking for simple NSCursor example code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Looking for simple NSCursor example code
      • From: Greg Titus <email@hidden>
  • Prev by Date: Re: Distributed Objects passing structures? (punching holes in my data)
  • Next by Date: Re: how do i read and send data through a serial port (using a keyspan adaptor), reactions
  • Previous by thread: Re: Distributed Objects passing structures? (punching holes in my data)
  • Next by thread: Re: Looking for simple NSCursor example code
  • Index(es):
    • Date
    • Thread