Re: didPrint selector not called

2016-12-16 Thread Manoah F. Adams
On Dec 16, 2016, at 08:45:00, Jeremy Hughes wrote: Hi, I’m overriding printDocumentWithSettings in order to get a notification for when printing has finished, but the didPrint selector is never called. This is the code: class func document(document: NSDocument, didPrint: Bool, context

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
> On 16 Dec 2016, at 21:54, Jeremy Hughes wrote: > >> In that case, you don’t know for sure who calls it and when. It appears to >> documented that it’s called as part of the standard implementation of >> “printDocument”, but you don’t know if there are other circumstances where >> it’s calle

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
> On 16 Dec 2016, at 21:40, Quincey Morris > wrote: > > On Dec 16, 2016, at 12:01 , Jeremy Hughes wrote: >> >> It’s just an application method, which overrides the method that the system >> calls from printDocument when a user chooses Print. > > Just to be clear, does the “it” in that senten

Re: didPrint selector not called

2016-12-16 Thread Quincey Morris
On Dec 16, 2016, at 12:01 , Jeremy Hughes wrote: > > It’s just an application method, which overrides the method that the system > calls from printDocument when a user chooses Print. Just to be clear, does the “it” in that sentence refer to “printDocumentWithSettings”? In that case, you don’t

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
> This is what I’ve currently got. It works OK, but the dictionary conversion > seems clunky to me. > > override func printDocument(sender: AnyObject?) > { > let didPrintSelector = #selector(document(_:didPrint:contextInfo:)) > > let dictionary = printInfo.dictionary() >

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
> On 16 Dec 2016, at 20:17, Jeremy Hughes wrote: >>> I'm not an expert in this part of Cocoa. Are there implicit system >>> *callers* of this method, or is it more of a system *utility* that you're >>> expected to call from your own code? If it's the latter, then maybe >>> instead of overridi

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
> On 16 Dec 2016, at 20:01, Jeremy Hughes wrote: > >>> OK - I misunderstood what Quincey was saying. >>> >>> The passed-in delegate and selector are nil, but I obviously can’t be sure >>> that they will always be nil. >>> >>> All I’m actually trying to do is to clean up some objects that need

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
>> OK - I misunderstood what Quincey was saying. >> >> The passed-in delegate and selector are nil, but I obviously can’t be sure >> that they will always be nil. >> >> All I’m actually trying to do is to clean up some objects that need to exist >> during the print operation. Is this the best w

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
Also, NSInvocation (used in the release notes sample code) is unavailable in Swift. Jeremy -- > On 16 Dec 2016, at 19:33, Jeremy Hughes wrote: > >> >> On 16 Dec 2016, at 19:29, John McCall wrote: >> >>> On Dec 16, 2016, at 11:24 AM, Jeremy Hughes >>> wrote: >>> Thanks for the link. >>>

Re: didPrint selector not called

2016-12-16 Thread John McCall
> On Dec 16, 2016, at 11:33 AM, Jeremy Hughes > wrote: >> On 16 Dec 2016, at 19:29, John McCall wrote: >> >>> On Dec 16, 2016, at 11:24 AM, Jeremy Hughes >>> wrote: >>> Thanks for the link. >>> >>> I’ve looked at it, and I don’t think it applies in this case, because I’m >>> not actually ov

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
> On 16 Dec 2016, at 19:29, John McCall wrote: > >> On Dec 16, 2016, at 11:24 AM, Jeremy Hughes >> wrote: >> Thanks for the link. >> >> I’ve looked at it, and I don’t think it applies in this case, because I’m >> not actually overriding the document(_:didPrint:contextInfo:) method, just >>

Re: didPrint selector not called

2016-12-16 Thread John McCall
> On Dec 16, 2016, at 11:24 AM, Jeremy Hughes > wrote: > Thanks for the link. > > I’ve looked at it, and I don’t think it applies in this case, because I’m not > actually overriding the document(_:didPrint:contextInfo:) method, just > providing it as a callback. There isn’t an override keyword

Re: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
Thanks for the link. I’ve looked at it, and I don’t think it applies in this case, because I’m not actually overriding the document(_:didPrint:contextInfo:) method, just providing it as a callback. There isn’t an override keyword before the method, and there isn’t a superclass method that I can

Fwd: didPrint selector not called

2016-12-16 Thread Jeremy Hughes
Sorry - I forgot to copy to the list. Jeremy -- > Begin forwarded message: > > From: Jeremy Hughes > Subject: Re: didPrint selector not called > Date: 16 December 2016 at 19:15:10 GMT > To: John McCall > >> On 16 Dec 2016, at 17:24, John McCall wrote: >>

Re: didPrint selector not called

2016-12-16 Thread Quincey Morris
On Dec 16, 2016, at 08:45 , Jeremy Hughes wrote: > > override func printDocumentWithSettings(printSettings: [String : AnyObject], > showPrintPanel: Bool, delegate: AnyObject?, didPrintSelector: Selector, > contextInfo: UnsafeMutablePointer) > { > let didPrint = #selector(Document.document

Re: didPrint selector not called

2016-12-16 Thread John McCall
> On Dec 16, 2016, at 8:45 AM, Jeremy Hughes > wrote: > Hi, > > I’m overriding printDocumentWithSettings in order to get a notification for > when printing has finished, but the didPrint selector is never called. > > This is the code: > > class func document(document: NSDocument, didPrint: Bo

didPrint selector not called

2016-12-16 Thread Jeremy Hughes
Hi, I’m overriding printDocumentWithSettings in order to get a notification for when printing has finished, but the didPrint selector is never called. This is the code: class func document(document: NSDocument, didPrint: Bool, contextInfo: UnsafeMutablePointer) { print("document was pr