• 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
Drawing custom insertion point in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Remove excess line breaks
  • Next by Date: Re: Localization
  • Previous by thread: Re: Localization
  • Next by thread: Adding items to the menu that appears when you right-click a file in the finder?
  • Index(es):
    • Date
    • Thread