RE: setDocumentCursor usage?
RE: setDocumentCursor usage?
- Subject: RE: setDocumentCursor usage?
- From: Keith Blount <email@hidden>
- Date: Tue, 5 Apr 2005 00:31:06 -0700 (PDT)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello Mark,
> What does setDocumentCursor do? I know its part of
the NSClipView
> class and is described:Sets the cursor object used
over the receiver to
> aCursor.
> I'm setting it to a cursor when I start a mouse down
operation;
> however, the cursor isn't changed.
What is clip view's/scroll view's document view? How I
understand it, if the document view already defines a
cursor in resetCursorRects, this will override
setDocumentCursor: so that it has no effect. Because
setDocumentCursor: only affects the actual clip view,
it really just provides the default cursor for
documents. For instance, a text view sets up an IBeam
cusor in resetCursorRects, so if that is the document
view of the scroll view, setDocumentCursor: will
appear to do nothing.
If this is the case, and you need to set the cursor in
a view that already defines a cursor, then you
probably need to subclass the view and override
-resetCursorRects. For instance, where mouseDown is a
simple BOOL instance variable and mouseDownCursor is
your custom cursor:
- (void)resetCursorRects
{
if (mouseDown)
[self addCursorRect:[self visibleRect]
cursor:mouseDownCursor];
else
[super resetCursorRects];
}
- (void)mouseDown:(NSEvent *)theEvent
{
mouseDown = YES;
[[self window] invalidateCursorRectsForView:self];
}
- (void)mouseUp:(NSEvent *)theEvent
{
mouseDown = NO;
[[self window] invalidateCursorRectsForView:self];
}
(That's just off the top of my head and there's
probably a more elegant way.)
HTH,
Keith
__________________________________
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.
http://www.advision.webevents.yahoo.com/emoticontest
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden