• 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 update preview in NSPrintPanel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to update preview in NSPrintPanel?


  • Subject: Re: How to update preview in NSPrintPanel?
  • From: Graham Cox <email@hidden>
  • Date: Mon, 26 Dec 2011 11:59:37 +1100

On 26/12/2011, at 9:05 AM, Luc Van Bogaert wrote:

> Hi,
>
> I'm adding a custom user setting to a NSPrintPanel by adding an "accessory view controller" for a view that contains just one control (a checkbox) and which is loaded from a nib file. The checkbox's value has a binding to the view controller's "representedObject.printSettings.checkboxvalue" keypath. (The representedObject is a NSPrintInfo object).
>
> I have been able to verify that this binding works correctly.
>
> One thing I haven't gotten to work yet, is to automatically update the "preview" in the print panel when I chance the state of the checkbox. The preview updates itself correctly when I change one of the "built-in" settings, and it even correctly represents my own custom setting. But, how can I trigger an automatic update when I just change my own custom setting?
>
> I assume I should implement the  "keyPathsForValuesAffectingPreview" protocol method in my accessory view controller, which I did, but so far without success. Here's my implementation:
>
> - (NSSet *)keyPathsForValuesAffectingPreview
> {
>    return [NSSet setWithObjects:
>            [NSString stringWithFormat:@"representedObject.printSettings.checkboxvalue"],
>            nil];
> }
>
> Any help much appreciated.
>
> --
> Luc Van Bogaert


Well, I have added a print accessory view, but I'm not using bindings.

My accessory view controller implements this:

- (NSSet *)		keyPathsForValuesAffectingPreview
{
	return [NSSet setWithObjects:@"fitToSinglePage", @"cropMarks", @"printsGraphPaper", nil];
}


where the strings here are the names of properties implemented by the controller. I don't know how that translates to bindings, or on what object. It's a long time since I wrote this code, I forget much of the thought process that went into it, but it works reliably and I've never needed to look at it again. The controller makes changes to the NSPrintOperation object which it holds as a property.

Probably not much help, but you're on the right track, so persevere…..

--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

References: 
 >How to update preview in NSPrintPanel? (From: Luc Van Bogaert <email@hidden>)

  • Prev by Date: How to update preview in NSPrintPanel?
  • Next by Date: Re: Storyboard SplitViewController example
  • Previous by thread: How to update preview in NSPrintPanel?
  • Next by thread: Re: How to update preview in NSPrintPanel?
  • Index(es):
    • Date
    • Thread