Re: How to know user clicks [print] button in cocoa PDE
Re: How to know user clicks [print] button in cocoa PDE
- Subject: Re: How to know user clicks [print] button in cocoa PDE
- From: Dustin Voss <email@hidden>
- Date: Sat, 9 Sep 2006 11:05:57 -0700
On 7 Sep 2006, at 2:33 AM, Jeff Chen wrote:
I can't catch the event that user presses [Print] button, in carbon
PDE, I can get the ControlRef of [Print] button and install event
handler to it. However, in cocoa, I can only get the NSButton *
pointer of [Print] button, but I can't install event handler to
NSControl in cocoa. I can only use the event in NSResponder. But
NSResponder doesn't provide the event that handles the clicking of
[Print] Button.
Who knows how I can catch the event that user clicks [print] Button
in cocoa? Or who knows how to install event handler to a special
NSControl in cocoa?
You are writing a printer-specific item for the Print panel? And you
want to do something when the user clicks Print? I assume the PDE
close and terminate callbacks aren't sufficient, because you only
want to do this if he clicks Print. I also assume that you can't do
what you need in the printer module callbacks listed here:
http://developer.apple.com/documentation/Printing/Reference/
PrintingPlugin_Ref/Reference/reference.html#//apple_ref/doc/uid/
TP30000241-CH2g-TPXREF104
If you have the NSButton *, I think you can intercept its action as
follows:
1. Call -action and -target to find out what it does now.
2. Redefine what it does by calling -setTarget: with your class and -
setAction: with the method you want it to call.
3. In that method, make sure you call the original action on the
original target.
_______________________________________________
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