Drawing custom insertion point in NSTextView
Drawing custom insertion point in NSTextView
- Subject: Drawing custom insertion point in NSTextView
- From: Fabian Lidman <email@hidden>
- Date: Mon, 15 Dec 2003 17:33:33 +0100
Hello folks,
I have asked this question in various forums before, and i have never
recieved any answer. Basically i'm trying to limit the places in a
subclassed NSTextView where a certain type of data can be dropped, so
in my overridden draggingUpdated function i need to draw an insertion
point (preferrably a red one) to give the user visual feedback on
whether the current mouse location is an acceptable place to drop the
data. My code basically looks like:
insertionPointRect = [self customInsertionPointRectForCharacterIndex:
characterIndexForDrop];
[self lockFocus];
[self drawInsertionPointInRect: insertionPointRect color: myRedColor
turnedOn: YES];
[self unlockFocus];
However, this fails to draw anything at all. The coordinates of the
rectangle look correct in the debugger. I've seen other people ask
about the same problem -- is there something we have missed? Obviously
the drawInsertionPointInRect itself does work since NSTextView itself
relies on it to draw the caret on its own. I also tried overriding
shouldDrawInsertionPoint to always return YES, but it doesnt' help.
Any help is greatly appreciated!
Fabian Lidman
_______________________________________________
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.