Re: Question on pasteboard manager
Re: Question on pasteboard manager
- Subject: Re: Question on pasteboard manager
- From: Graham Cox <email@hidden>
- Date: Sat, 21 Feb 2009 10:25:19 +1100
On 21/02/2009, at 4:25 AM, Anin Teger wrote:
Hi,
I'm looking for a way/API/etc to do 2 things. I'm not sure this is
possible on Mac OSX but here goes.
1. To programatically enable the Paste menu item in any application's
Edit menu. I'm not looking to do this for any specific application
but
in general so that if you were to open any application that has an
Edit
menu, the Paste menu item would be enabled. I couldn't figure out how
to do this with the Pasteboard manager API.
and
2. When a user clicks the "Paste" menu item, I'd like to register a
call
back function so that my function would be called first. I could then
insert data into the pasteboard and have the application paste those
contents.
Any ideas? I am interested in porting a Windows based application
that
relies on this functionality.
Sounds like you haven't really understood how cut-and-paste works. I
don't know if it's fundamentally different on Windows (doubtful) but
you don't "push" a cut/paste operation to another app. Instead you use
a central pasteboard server that holds the data you cut, and other
apps can make use of what they find there as they wish - they'll
enable "Paste" if they find data they can use and have somewhere to
put it.
You can register a callback that gets called when another app pastes
your data - this is called a "promise". It still works using the
central pasteboard server - you put placeholder data on the pasteboard
which another app will detect and enable Paste as appropriate, but
when it actually requests the data it calls your app to provide it.
There is no way to "force" another app to enable Paste, all you can do
is make useful data available and other apps will enable Paste if they
can use it.
See:
http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/CopyandPaste.html
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden