Re: KVO: I get called on change, but then can't get the object

2008-06-01 Thread Hamish Allan
On Sun, Jun 1, 2008 at 1:02 AM, Scott Anguish [EMAIL PROTECTED] wrote:

 swearing isn't appropriate here. :-)

After Apple have failed to fix this glaring known bug after another
two major releases of the operating system? I beg to differ :P

Hamish
___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-06-01 Thread Quincey Morris


On Jun 1, 2008, at 12:49, Hamish Allan wrote:

On Sun, Jun 1, 2008 at 1:02 AM, Scott Anguish [EMAIL PROTECTED]  
wrote:



swearing isn't appropriate here. :-)


After Apple have failed to fix this glaring known bug after another
two major releases of the operating system? I beg to differ :P

Hamish


OTOH, the news isn't all bad. I haven't seen any GC-app NSOpenPanel  
crashes since 10.5.3. If that is in fact fixed, it'll make a lot of  
people happy.



___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread j o a r


On May 31, 2008, at 12:21 AM, Rick Mann wrote:

I registered to observe changes in the number column of my tree  
controller:


[mItemsController addObserver: self
forKeyPath: @selection.number
options: (NSKeyValueObservingOptionNew)
context: NULL];

My -observe: action gets called, but this line

	NSLog(@Value changed %@: %@ (%@), inKeyPath, inChange, [inObject  
selection]);


dumps this to the console:

Value changed selection.number: {
   kind = 1;
   new = null;
} (_NSControllerObjectProxy: 0x177cb0)

Note that new is null. I would expect it to be the value of the  
number.



Search for NSKeyValueObservingOptionNew here:

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html



Furthermore, this line:

NSLog(@selection: %@, [inObject valueForKey: @selection]);

dumps:

selection: _NSControllerObjectProxy: 0x177cb0

But if I change it to @selection.number, it throws the exception:

[NSTreeController 0x1722e0 valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number.



What happens if you call -valueForKeyPath: instead of -valueForKey:?

j o a r


___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Rick Mann


On May 31, 2008, at 00:32:30, j o a r wrote:


Search for NSKeyValueObservingOptionNew here:



Already using that:

[mItemsController addObserver: self
forKeyPath: @selection.number
options: (NSKeyValueObservingOptionNew)
context: NULL];


What happens if you call -valueForKeyPath: instead of - 
valueForKey:?


Argh! That works. I'm so used to the Java version that doesn't  
distinguish between a key and a path. Thanks!


--
Rick

___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Hamish Allan
On Sat, May 31, 2008 at 8:48 AM, Rick Mann [EMAIL PROTECTED] wrote:

 On May 31, 2008, at 00:32:30, j o a r wrote:

 Search for NSKeyValueObservingOptionNew here:

 Already using that:

Read it again:

The change dictionary doesn't contain old and new values. This is not
your fault, it's due to a bug in the controller. This bug will not be
fixed in the forseeable future.

Can mmalc or anyone else give an explanation of why not?

Hamish
___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Jonathan del Strother
On Sat, May 31, 2008 at 10:03 AM, Hamish Allan [EMAIL PROTECTED] wrote:
 On Sat, May 31, 2008 at 8:48 AM, Rick Mann [EMAIL PROTECTED] wrote:

 On May 31, 2008, at 00:32:30, j o a r wrote:

 Search for NSKeyValueObservingOptionNew here:

 Already using that:

 Read it again:

 The change dictionary doesn't contain old and new values. This is not
 your fault, it's due to a bug in the controller. This bug will not be
 fixed in the forseeable future.

 Can mmalc or anyone else give an explanation of why not?


I could've sworn that was fixed in Leopard, actually.   Anyone tried it?
___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Hamish Allan
On Sat, May 31, 2008 at 11:11 AM, Jonathan del Strother
[EMAIL PROTECTED] wrote:
 On Sat, May 31, 2008 at 10:03 AM, Hamish Allan [EMAIL PROTECTED] wrote:
 On Sat, May 31, 2008 at 8:48 AM, Rick Mann [EMAIL PROTECTED] wrote:
 On May 31, 2008, at 00:32:30, j o a r wrote:

 Search for NSKeyValueObservingOptionNew here:

 Already using that:

 Read it again:

 The change dictionary doesn't contain old and new values. This is not
 your fault, it's due to a bug in the controller. This bug will not be
 fixed in the forseeable future.

 Can mmalc or anyone else give an explanation of why not?

 I could've sworn that was fixed in Leopard, actually.   Anyone tried it?

I have -- it isn't fixed.

http://www.cocoabuilder.com/archive/message/cocoa/2008/4/17/204421

Hamish
___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Rick Mann


On May 31, 2008, at 03:11:51, Jonathan del Strother wrote:

I could've sworn that was fixed in Leopard, actually.   Anyone tried  
it?



I have ;-)

--
Rick

___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Scott Anguish

array controllers are not fully KVO compliant.

they don't return change values.


On May 31, 2008, at 3:21 AM, Rick Mann wrote:

I registered to observe changes in the number column of my tree  
controller:


[mItemsController addObserver: self
forKeyPath: @selection.number
options: (NSKeyValueObservingOptionNew)
context: NULL];

My -observe: action gets called, but this line

	NSLog(@Value changed %@: %@ (%@), inKeyPath, inChange, [inObject  
selection]);



dumps this to the console:

Value changed selection.number: {
   kind = 1;
   new = null;
} (_NSControllerObjectProxy: 0x177cb0)

Note that new is null. I would expect it to be the value of the  
number.


Furthermore, this line:

NSLog(@selection: %@, [inObject valueForKey: @selection]);

dumps:

selection: _NSControllerObjectProxy: 0x177cb0

But if I change it to @selection.number, it throws the exception:

[NSTreeController 0x1722e0 valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number.




From reading the docs:

NSObjectController and its subclasses implement the selection  
method. This method returns a proxy object that represents the  
receiver’s current selection. The proxy is fully key-value-coding  
compliant.
When you request a key’s value from the selection proxy it returns  
the value, or a selection marker. Placeholder markers provide  
additional information about the selection. There are three  
placeholder markers defined in the NSPlaceholders informal protocol:


It seems that I should be able to get the number from the selection,  
but instead I get the exception:


[NSTreeController 0x170c60 valueForUndefinedKey:]: this class is  
not key value coding-compliant for the key selection.number.




I feel like I should be able to get the number. Elsewhere I read  
that I would get an array of numbers. What am I doing wrong?




TIA,




--
Rick

___

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/scott%40cocoadoc.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: KVO: I get called on change, but then can't get the object

2008-05-31 Thread Scott Anguish


On May 31, 2008, at 6:11 AM, Jonathan del Strother wrote:

On Sat, May 31, 2008 at 10:03 AM, Hamish Allan [EMAIL PROTECTED]  
wrote:
On Sat, May 31, 2008 at 8:48 AM, Rick Mann [EMAIL PROTECTED]  
wrote:


On May 31, 2008, at 00:32:30, j o a r wrote:


Search for NSKeyValueObservingOptionNew here:


Already using that:


Read it again:

The change dictionary doesn't contain old and new values. This is  
not

your fault, it's due to a bug in the controller. This bug will not be
fixed in the forseeable future.

Can mmalc or anyone else give an explanation of why not?



I could've sworn that was fixed in Leopard, actually.   Anyone tried  
it?


swearing isn't appropriate here. :-)

and no, it hasn't been fixed.

___

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 [EMAIL PROTECTED]