Page 1 of 1

how to register an observer

PostPosted: Fri Dec 10, 2010 8:43 am
by udo.killermann
Bernd,

how can I register an observer via ObjB? I see the the event "ObserveValueForKeyPath" but I don't find a way to relate a property to this event.

I have achieved to register an observer using vanilla Cocoa API through Declare but would like to do it the intended way.

Thanks for your help,
Udo

Re: how to register an observer

PostPosted: Fri Dec 10, 2010 10:07 am
by berndnoetscher
udo.killermann wrote:Bernd,

how can I register an observer via ObjB? I see the the event "ObserveValueForKeyPath" but I don't find a way to relate a property to this event.

I have achieved to register an observer using vanilla Cocoa API through Declare but would like to do it the intended way.

Thanks for your help,
Udo


Udo,

there is no documentation about it in objb yet.
But take a look at objb's NSObject documentation. There are several functions:


AddObserver(..), RemoveObserver(...), WillChangeValueForKey and so on

Some links to external info:

http://cocoawithlove.com/2008/06/five-a ... rving.html

http://stackoverflow.com/questions/3018 ... alueforkey

If you need some help, please let me know.

Re: how to register an observer

PostPosted: Fri Dec 10, 2010 1:20 pm
by udo.killermann
Bernd,

the current HTML documentation doesn't tell anything about the mentioned subs and neither does the code completion. How would one know these things? I did a search for "observ" prior to my post and all I got was the mentioned event.

Regards
Udo

Re: how to register an observer

PostPosted: Wed Dec 15, 2010 12:14 pm
by berndnoetscher
udo.killermann wrote:Bernd,

the current HTML documentation doesn't tell anything about the mentioned subs and neither does the code completion. How would one know these things? I did a search for "observ" prior to my post and all I got was the mentioned event.

Regards
Udo


Udo,

sorry my mistake. I fought I did implement those functions, but as I checked again. There are not implemented completely yet. Your option is now to wait for the official support or stick to the Cocoa API directly. Sorry again.