• 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
Re: Double-click and drag word in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Double-click and drag word in NSTextView


  • Subject: Re: Double-click and drag word in NSTextView
  • From: Keith Blount <email@hidden>
  • Date: Tue, 10 Oct 2006 15:15:02 -0700 (PDT)

Sorry to reply to my own post, but I forgot to add
that I have already tried:

smartInsertForString:replacingRange:beforeString:afterString:

This works great, except that I thought this would
return nothing if the user hadn't double-clicked the
word, which turns out not to be the case. If I
incorporate this into my code, then smart-spaces get
added even if the user dragged the mouse to select
rather than double-clicked. So the problem remains
that I need some way of knowing whether the the paste
should inititate smart spaces or not (ie. I need to
know if the word that is being pasted was selected by
a double-click).

Thanks in advance,
Keith

----

Hello,

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,
Keith

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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

  • Prev by Date: Double-click and drag word in NSTextView
  • Next by Date: Re: Double-click and drag word in NSTextView
  • Previous by thread: Double-click and drag word in NSTextView
  • Next by thread: Re: Double-click and drag word in NSTextView
  • Index(es):
    • Date
    • Thread