• 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: How to know user clicks [print] button in cocoa PDE
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • RE: How to know user clicks [print] button in cocoa PDE
      • From: "Jeff Chen" <email@hidden>
References: 
 >How to know user clicks [print] button in cocoa PDE (From: "Jeff Chen" <email@hidden>)

  • Prev by Date: Re: Re: Re: Re: How do I get the NSApplication of other running applications?
  • Next by Date: Re: Re: Re: Tracking rectangles and bezier paths
  • Previous by thread: How to know user clicks [print] button in cocoa PDE
  • Next by thread: RE: How to know user clicks [print] button in cocoa PDE
  • Index(es):
    • Date
    • Thread