Re: Key path for values in "Shared User Defaults"? [SOLVED]

2009-03-24 Thread Matthias Arndt

Keary,

On 24.03.2009, at 16:21 Keary Suska wrote:

OTOH, you could have an outlet to the defaults controller, say,  
named "defaultsController" and use  
@"defaultsController.values.DEFALTSKEY" to  
keyPathsForValuesAffectingPreview. I think that is supposed to work...


Wow, thank you so much, you really made my day! Yesterday I already  
tried "values.DEFAULTSKEY" as a key path, and wondered how to  
reference the defaults controller. I just didn't thought of  
IBOutlet'ing it, shame on me ...


This code snippet works perfectly:


- (NSSet *)keyPathsForValuesAffectingPreview
{
	// Use KVO to update the print panel's preview if one of the  
options is changed. The defaultsController is bound via IBOutlet


return [NSSet setWithObjects:
@"defaultsController.values.PrintJumps",
@"defaultsController.values.PrintGrid",
@"defaultsController.values.PrintFastMode",
nil];
}


Take care, Mattes
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Key path for values in "Shared User Defaults"?

2009-03-24 Thread Keary Suska


On Mar 23, 2009, at 1:54 PM, Matthias Arndt wrote:

Please help me: What is the key path of a value stored in the shared  
user defaults?


I'm using a sub-classed NSViewController to enhance the print panel  
with an accessory view:



NSBundle *appBundle = [NSBundle bundleForClass:[self class]];
NSViewController *accessoryViewController = [[PrintOptions alloc]  
initWithNibName:@"PrintOptions" bundle:appBundle];
[[printOperation printPanel]  
addAccessoryController:accessoryViewController];


The view "PrintOptions" includes three checkboxes, all bind to the  
Shared User Defaults Controller. The printed view uses these values  
to modify its output. Everything works fine except the preview in  
the print panel: It isn't updated when I check / uncheck any of the  
boxes, although the view controller conforms to the  
"NSPrintPanelAccessorizing" protocol and should use KVO to be  
notified for changes.


I think my "keyPathsForValuesAffectingPreview" implementation is  
wrong as I don't know how to reference a shared user default:



- (NSSet *)keyPathsForValuesAffectingPreview
{
	return [NSSet setWithObjects: @"PrintFastMode", @"PrintJumps",  
@"PrintGrid", nil];

}


The documentation I found only mentioned an example with document  
margins, but what is the key path for properties bind to the user  
defaults? Sorry, I'm totally lost ...



OTOH, you could have an outlet to the defaults controller, say, named  
"defaultsController" and use @"defaultsController.values.DEFALTSKEY"  
to keyPathsForValuesAffectingPreview. I think that is supposed to  
work...


HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Key path for values in "Shared User Defaults"?

2009-03-23 Thread Matthias Arndt
Please help me: What is the key path of a value stored in the shared  
user defaults?


I'm using a sub-classed NSViewController to enhance the print panel  
with an accessory view:



NSBundle *appBundle = [NSBundle bundleForClass:[self class]];
NSViewController *accessoryViewController = [[PrintOptions alloc]  
initWithNibName:@"PrintOptions" bundle:appBundle];
[[printOperation printPanel]  
addAccessoryController:accessoryViewController];



The view "PrintOptions" includes three checkboxes, all bind to the  
Shared User Defaults Controller. The printed view uses these values to  
modify its output. Everything works fine except the preview in the  
print panel: It isn't updated when I check / uncheck any of the boxes,  
although the view controller conforms to the  
"NSPrintPanelAccessorizing" protocol and should use KVO to be notified  
for changes.


I think my "keyPathsForValuesAffectingPreview" implementation is wrong  
as I don't know how to reference a shared user default:



- (NSSet *)keyPathsForValuesAffectingPreview
{
	return [NSSet setWithObjects: @"PrintFastMode", @"PrintJumps",  
@"PrintGrid", nil];

}


The documentation I found only mentioned an example with document  
margins, but what is the key path for properties bind to the user  
defaults? Sorry, I'm totally lost ...


Mattes
 
___


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com