BOOL madness

2008-11-11 Thread Andre Masse
Hi, I'm having trouble converting an object to a BOOL. In my window controller, I'm observing the model keyPath isDirty which is a BOOL. version 1 - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object

Re: BOOL madness

2008-11-11 Thread Rob Keniger
On 12/11/2008, at 11:08 AM, Andre Masse wrote: I'm having trouble converting an object to a BOOL. In my window controller, I'm observing the model keyPath isDirty which is a BOOL. BOOL is not an object type. You need to use [myObject boolValue] to get a BOOL. -- Rob Keniger

Re: BOOL madness

2008-11-11 Thread Roland King
[ [ change objectForKey:NSKeyValueChangeNewKey ] boolValue ]? it's an object, not a bool, it prints as a bool because the object knows it's a bool, but you are just testing the object pointer which isn't 0x00 Andre Masse wrote: Hi, I'm having trouble converting an object to a BOOL. In my

Re: BOOL madness

2008-11-11 Thread Graham Cox
On 12 Nov 2008, at 12:08 pm, Andre Masse wrote: Hi, I'm having trouble converting an object to a BOOL. In my window controller, I'm observing the model keyPath isDirty which is a BOOL. version 1 - (void) observeValueForKeyPath:(NSString *)keyPath

Re: BOOL madness

2008-11-11 Thread Charles Steinman
From: Andre Masse [EMAIL PROTECTED] To: Cocoa Developers cocoa-dev@lists.apple.com Sent: Tuesday, November 11, 2008 5:08:20 PM Subject: BOOL madness Hi, I'm having trouble converting an object to a BOOL. In my window controller, I'm observing the model keyPath isDirty which is a BOOL

Re: BOOL madness

2008-11-11 Thread Andre Masse
Thanks a lot, this the method I was looking for. Andre Masse On Nov 11, 2008, at 20:11, Rob Keniger wrote: BOOL is not an object type. You need to use [myObject boolValue] to get a BOOL. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: BOOL madness

2008-11-11 Thread Jim Correia
On Nov 11, 2008, at 8:08 PM, Andre Masse wrote: I'm having trouble converting an object to a BOOL. In my window controller, I'm observing the model keyPath isDirty which is a BOOL. version 1 - (void) observeValueForKeyPath:(NSString *)keyPath

Re: BOOL madness

2008-11-11 Thread Andre Masse
I was looking everywhere for BOOL methods conversion and couldn't find any. Now I know why: BOOL is not an object type. Not sure how I could have found [myObject boolValue] though... Now that I know about it, I searched the documentation reference and found that is a method implemented by

Re: BOOL madness

2008-11-11 Thread Andre Masse
Thanks for pointing that out. I'll check the archives. Andre Masse On Nov 11, 2008, at 20:28, Jim Correia wrote: I know this isn't the question you asked, nor the root of the problem you are having, but by way of saving you future pain, that is not the correct way to write an -

Re: BOOL madness

2008-11-11 Thread Andre Masse
For the sake of followers of this thread and after having read the archives, here's the final version: static NSString *GHMainWindowControllerIsDirtyObservingContext; ... - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object

Re: BOOL madness

2008-11-11 Thread Michael Ash
On Tue, Nov 11, 2008 at 8:36 PM, Andre Masse [EMAIL PROTECTED] wrote: I was looking everywhere for BOOL methods conversion and couldn't find any. Now I know why: BOOL is not an object type. Not sure how I could have found [myObject boolValue] though... Now that I know about it, I searched the

Re: BOOL madness

2008-11-11 Thread Andre Masse
Thanks a lot for the doc pointer. Andre Masse On Nov 11, 2008, at 21:12, Michael Ash wrote: Key-Value Observing is built on top of Key-Value Coding, and KVC is documented to box non-object scalars using NSNumber and NSValue: