• 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: equivalent of the "X Selection" for cocoa apps?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equivalent of the "X Selection" for cocoa apps?


  • Subject: Re: equivalent of the "X Selection" for cocoa apps?
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Sun, 20 Feb 2005 14:55:48 +0100

At 0:26 Uhr -0500 20.02.2005, Matthew wrote:
I've noticed in recent times that for some Linux distributions use what appears to be called the "X Selection" to facilitate cutting and pasting. So instead of having to explicitly press ctrl-C (in Linux), you simply can make a selection and then use ctrl-V or the middle mouse button to paste--shortcutting the explicit ctrl-C keystroke for the copy.

Obviously there are a few ways to approach simulating this behavior for OS X, but before I begin, can anyone say whether or not a simple app already exists that does this? This is bit difficult to search for on the net. A thread from slashdot that's semi-relevant that mentions the "SELECTION buffer": http://slashdot.org/articles/01/01/09/2024229_F.shtml

MacOS X doesn't use X Windows for native applications. While X11 may have a selection buffer, OS X doesn't.


I hope you're planning to write this as a system-wide extension for users that want this feature on their system, and not as a feature in your app. Because Mac users are used to their clipboard not being replaced until they copy something new into it. If your app suddenly copied any text selections into the clipboard, you'd end up overwriting the user's data, and your app will end up trashed faster than you think. Users don't like losing data, at all.

That having been said, to achieve something like this, you'd probably have to override some methods in the NSText family of classes. NSText, NSTextContainer, NSTextStorage, NSLayoutManager... one of them should contain the hooks you'd need.

Maybe it's even as easy as catching NSTextViewDidChangeSelectionNotification.

Now, how to get that into other apps is an entirely different matter, one that you'd best get answered on the extendamac mailing list (SourceForge, or maybe Yahoo Groups -- not sure where it was again, but you know how to use Google). You'll probably have to use Wolf's Mach-Inject.

And even then, you'd still have to implement the same for Carbon apps to make that work system-wide. For the old TextEdit Manager (!= TextEdit.app!), and for the new ATSUI-based text fields (aka MLTE). I hope coding stuff like this is fun for you, because if it isn't, this will be a strain on you.

PS - I don't know whether that's an Eudora feature or whether this is now available system-wide, but here, I can also use F1-F4 to do Undo, cut, copy and paste. This may be easier for you than trying to fake the (rather dangerous) X11 behavior.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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
References: 
 >equivalent of the "X Selection" for cocoa apps? (From: Matthew <email@hidden>)

  • Prev by Date: Localizing hierarchical plist information?
  • Next by Date: Re: combining strings with floats into an NSTextView
  • Previous by thread: equivalent of the "X Selection" for cocoa apps?
  • Next by thread: Re: equivalent of the "X Selection" for cocoa apps?
  • Index(es):
    • Date
    • Thread