Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Double-click and drag word in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Double-click and drag word in NSTextView


I have a custom text view that overrides the copy and
paste methods (-writeSelectionToPasteboard:type:) etc.
I have to do this because my text can have custom
attributes applied, and if I don't use my own
pasteboard type these will get lost.

However, one of my users has noticed that this causes
an annoying "bug": the default behaviour of an
NSTextView is that if you double-click on a word to
select it and then drag and drop the word (or phrase)
somewhere else, spaces will be inserted around it as
necessary ("smartly"). But because I am overriding the
methods that do all this, this behaviour is broken in
my custom text view.

So, my question is, how do I go about reimplementing
this behaviour? ie. How do I detect whether the user
has double-clicked the word to select it, and
therefore know that I have to check the context of the
word when copying and pasting? Is there any way of
doing this, or any other solution?

Many thanks,

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
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

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.