You don't get notified when there's something new to paste. Instead,
the user tries to perform the paste, at which point you can check if
the pasteboard contains anything you can use. You can also perform
this check when validating the "paste" menu item so that Paste is
disabled (greyed out) when there's nothing to paste.
Much cleaner this way, since you are then driven by the user's actual
needs instead of keeping track of all sorts of potential state
information "just in case".
(by the way, does pasting the file URL here actually work? I assume
everyone will have the same Xcode installation... is there a way to
get the URL of the equivalent online site from the Xcode documentation
browser?)
G.
On 22 May 2008, at 10:08 pm, Adil Saleem wrote:
Let me be more precise this time. I haven't used
pasteboards before. I think i asked wrong question.
Actually i want my application to be notified whenever
there is a new text copied/cutted. So that i can paste
it in my application. So please guide me how that can
be achieved? (with or without delegates. whatever
works)
Thank you for your patience.
--- Graham Cox <email@hidden> wrote:
NSPasteboard indeed does not implement a
setDelegate: method.
The object you pass as <owner> in
-declareTypes:owner: can act as the
pasteboard's delegate in the case of when you
promise (but do not
actually provide) data when writing your data types
to the pasteboard.
What are you trying to do? Seems to me that
attempting to become a
"permanent" delegate of the general pasteboard in an
awakeFromNib
method is a very weird thing to do.