Re: KVO question

2015-11-18 Thread Gerd Knops
One possible issues is that `self.thingy=x;` will trigger two change notifications for `thingy`: one for `self.dictionaryOfThings = temp;` (due to keyPathsForValuesAffectingThingy), and one when the setter exits. Depending one what your observer does this may have unforeseen side effects. A

Re: KVO question

2015-11-18 Thread Ken Thomases
On Nov 17, 2015, at 7:18 PM, Graham Cox wrote: > > I’m using KVO to observe a bunch of properties. > > Most of these properties are split out into simple things that set a single > value, but internal to my object, some end up setting a common dictionary of >

Re: KVO question

2015-11-18 Thread Alex Zavatone
Are you implying that one KVO is blocking the others? Sent from my iPhone > On Nov 17, 2015, at 8:18 PM, Graham Cox wrote: > > I’m using KVO to observe a bunch of properties. > > Most of these properties are split out into simple things that set a single > value, but

Re: KVO question

2015-11-18 Thread Quincey Morris
On Nov 18, 2015, at 16:29 , Roland King wrote: > > I didn’t read his original question as saying that I could easily have got it wrong, but I believe what he was saying was that much of his system was working. The part that doesn’t work is when (e.g.) the Font Manager updates

Re: KVO question

2015-11-18 Thread Roland King
> On 19 Nov 2015, at 08:38, Quincey Morris > wrote: > > (sorry, posted the incomplete message by accident) > > On Nov 18, 2015, at 16:29 , Roland King > wrote: >> >> I didn’t read his original question as saying

Re: KVO question

2015-11-18 Thread Roland King
> On 19 Nov 2015, at 08:15, Quincey Morris > wrote: > > On Nov 18, 2015, at 14:35 , Graham Cox wrote: >> >> it’s just that if other code changes the attributes dictionary (such as the >> Font Manager) then I need these split out

Re: KVO question

2015-11-18 Thread Quincey Morris
(sorry, posted the incomplete message by accident) On Nov 18, 2015, at 16:29 , Roland King > wrote: > > I didn’t read his original question as saying that I could easily have got it wrong, but I believe what he was saying was that much of his system was

Re: KVO question

2015-11-18 Thread Graham Cox
Hi guys, thanks for your replies - sorry took a while to get back to this, was in a long meeting. Anyway, Quincey, I’m not trying to get notified for mutations to the dictionary. The dictionary is being replaced as a single entity wholesale. The way the font manager works is that for a given

Re: KVO question

2015-11-18 Thread Quincey Morris
On Nov 18, 2015, at 14:35 , Graham Cox wrote: > > it’s just that if other code changes the attributes dictionary (such as the > Font Manager) then I need these split out properties to trigger their > notifications so that the UI shows the change I think I understand,

Re: KVO question

2015-11-18 Thread Graham Cox
> On 18 Nov 2015, at 6:43 PM, Quincey Morris > wrote: > > As a matter of principle, I always think using a dictionary as an API to > properties is a terrible idea. You’re much better off defining an object that > actually has the properties, even if there

Re: KVO question

2015-11-17 Thread Daniel Stenmark
It seems like it *should* work. Are you sure you don’t have a typo in your addObserver: method? Considering that you’re using the dictionary’s property setter, keyPathsForValuesAffecting shouldn’t even be necessary. When I apply KVO, I try to mitigate the potential unsafely of key paths

KVO question

2015-11-17 Thread Graham Cox
I’m using KVO to observe a bunch of properties. Most of these properties are split out into simple things that set a single value, but internal to my object, some end up setting a common dictionary of attributes, which is also a property. I KVO observe both the simple properties and the common

Re: KVO question

2015-11-17 Thread Quincey Morris
On Nov 17, 2015, at 17:18 , Graham Cox wrote: > > Mostly this is working, but when code directly sets the dictionary property, > the other properties don’t trigger their observers, even though I’m > implementing the +keyPathsForValuesAffecting, which I believe > should

Re: NSArrayController KVO question...

2012-11-23 Thread Randy Widell
Well, I implemented your method and still had issues. Turns out the value binding for the drop-down menu was a secondary issue. After implementing your method, I could verify that changing the property did, in fact, trigger an update in the table. However, the values never changed in UI.

Re: NSArrayController KVO question...

2012-11-22 Thread jonat...@mugginsoft.com
On 21 Nov 2012, at 22:19, Randy Widell bornagainsl...@gmail.com wrote: Hmm. Well, I am updating the model (and the database that backs it). I just need the UI to reflect it. Hmm, that sounds wonky. The whole point of binding is that you can update your model and have your UI reflect the

Re: NSArrayController KVO question...

2012-11-22 Thread Randy Widell
Right, and in other places it works for me. For instance, I have a window with text fields bound to a model object through an object controller. Updating properties of the model updates the text fields. Reading your test below, one thing I was forgetting is that I am not binding a column in

Re: NSArrayController KVO question...

2012-11-22 Thread jonat...@mugginsoft.com
On 22 Nov 2012, at 18:57, Randy Widell bornagainsl...@gmail.com wrote: Right, and in other places it works for me. For instance, I have a window with text fields bound to a model object through an object controller. Updating properties of the model updates the text fields. Reading your

Re: NSArrayController KVO question...

2012-11-22 Thread Randy Widell
You presume correctly. Your suggestion makes perfect sense. I was just reading about key dependencies yesterday, but didn't put 2 and 2 together because I wasn't think about the way the table view was setup. Thanks for the help! On Nov 22, 2012, at 12:16 PM, jonat...@mugginsoft.com wrote:

NSArrayController KVO question...

2012-11-21 Thread Randy Widell
Searching around the Internet, I see a lot of questions and answers about how to observe changes to properties of objects in a NSArrayController. Everything I have seen, though, relates to a third object doing the observing. For instance: [arrayController addObserver: viewObject forKeyPath:

Re: NSArrayController KVO question...

2012-11-21 Thread jonat...@mugginsoft.com
On 21 Nov 2012, at 20:42, Randy Widell bornagainsl...@gmail.com wrote: Searching around the Internet, I see a lot of questions and answers about how to observe changes to properties of objects in a NSArrayController. Everything I have seen, though, relates to a third object doing the

Re: NSArrayController KVO question...

2012-11-21 Thread Randy Widell
Hmm. Well, I am updating the model (and the database that backs it). I just need the UI to reflect it. I guess I was assuming that NSArrayController would respond to a value observation the same way it responds to, for instance, a selection change in the table view (updates the menu item's

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-28 Thread Richard Somers
On Sep 11, 2012, at 10:06 AM, Motti Shneor su...@bezeqint.net wrote: OK. Could you spare some pseudo-code for this? Or some link to a known code-sample? or maybe some 10 highlight lines from your own utilities? Documentation on method swizzling isn't that easy to use. In my case, all I

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-11 Thread Motti Shneor
On 10 בספט 2012, at 20:22, Richard Somers wrote: On Sep 10, 2012, at 5:59 AM, Motti Shneor wrote: Although I don't need such heavy-weapons, and I don't at all deal with programmatic bindings here, I'd still like (if possible) to learn some more about the implementation of your internal

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread Motti Shneor
Message - From: Quincey Morris quinceymor...@rivergatesoftware.com To: Motti Shneor su...@bezeqint.net Cc: Cocoa-Dev List Cocoa-dev@lists.apple.com Sent: Sunday, September 9, 2012 4:26:27 PM Subject: Re: KVO Question: How to programmatically determine if one object is observing another

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread Mike Abdullah
On 10 Sep 2012, at 11:40, Motti Shneor su...@bezeqint.net wrote: Thanks everyone. You are ALL right in your comments, and still my problem persists. In reality, I have at least 6 external triggers or state-changes that determine (in a quite complicated way) whether or not I should

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread James Montgomerie
On 10 Sep 2012, at 11:40, Motti Shneor su...@bezeqint.net wrote: My question is general. Supposedly I could NOT start observing once, and stop it once. Reasons: 1. There are many instances of that NSViewController 2. This observation is quite frequent in time (could reach 100 times a second)

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread Motti Shneor
Hello and thanks Richard. Although I don't need such heavy-weapons, and I don't at all deal with programmatic bindings here, I'd still like (if possible) to learn some more about the implementation of your internal tools. I didn't yet have a chance to work with swizzling, and maybe its time I

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread Mike Abdullah
On 10 Sep 2012, at 12:59, Motti Shneor su...@bezeqint.net wrote: Hello and thanks Richard. Although I don't need such heavy-weapons, and I don't at all deal with programmatic bindings here, I'd still like (if possible) to learn some more about the implementation of your internal tools.

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread Motti Shneor
There isn't much UI going on here. The representedObject is a CoreData managed object, updated frequently by remote server notifications. I'm observing a to-many relation somewhere down the attribute-path of the representedObject, trying to filter only those new/updated items of interest.

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-10 Thread Richard Somers
On Sep 10, 2012, at 5:59 AM, Motti Shneor wrote: Although I don't need such heavy-weapons, and I don't at all deal with programmatic bindings here, I'd still like (if possible) to learn some more about the implementation of your internal tools. I didn't yet have a chance to work with

KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Motti Shneor
Hi everyone. This seems a novice question, but I could not find any high-level approach for that. Some details of my special need: I have an NSViewController subclass, that should observe some attribute of its representedObject. However, the representedObject may change to another, become nil

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Richard Somers
On Sep 9, 2012, at 3:32 AM, Motti Shneor wrote: - (NSUInteger)isObserver:(id)object on keyPath:(NSString *)keyPath withContext:(void *)context]; // the returned number is the count of same observances with 0 as not-observing). and something like - (BOOL)removeObserver:(id)object;

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Mike Abdullah
On 9 Sep 2012, at 10:32, Motti Shneor su...@bezeqint.net wrote: Hi everyone. This seems a novice question, but I could not find any high-level approach for that. Some details of my special need: I have an NSViewController subclass, that should observe some attribute of its

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Ken Thomases
On Sep 9, 2012, at 4:32 AM, Motti Shneor wrote: Hi everyone. This seems a novice question, but I could not find any high-level approach for that. Some details of my special need: I have an NSViewController subclass, that should observe some attribute of its representedObject. However,

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Motti Shneor
On 9 בספט 2012, at 22:04, Ken Thomases wrote: On Sep 9, 2012, at 4:32 AM, Motti Shneor wrote: Hi everyone. This seems a novice question, but I could not find any high-level approach for that. Some details of my special need: I have an NSViewController subclass, that should observe

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Fritz Anderson
On 9 Sep 2012, at 3:50 PM, Motti Shneor su...@bezeqint.net wrote: Nope. When representedObject becomes nil, I DO NOT WANT to observe anything, and I need to remove the observance from the previous representedObject, BEFORE it is set to nil on my NSViewController. If I added myself as an

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Quincey Morris
On Sep 9, 2012, at 13:50 , Motti Shneor su...@bezeqint.net wrote: On 9 בספט 2012, at 22:04, Ken Thomases wrote: Why is that a however? What's the problem? Since the representedObject is KVO-compliant, all observations _through_ that property will automatically follow it as it changes.

Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?

2012-09-09 Thread Lee Ann Rucker
List Cocoa-dev@lists.apple.com Sent: Sunday, September 9, 2012 4:26:27 PM Subject: Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context? On Sep 9, 2012, at 13:50 , Motti Shneor su...@bezeqint.net wrote: On 9 בספט 2012, at 22:04, Ken

Re: KVO question

2010-07-05 Thread Sean McBride
On Thu, 1 Jul 2010 10:30:39 -0700, Rainer Standke said: I have a core data app where I don't necessarily know when managed objects go away, as in: become faults, will be deleted etc.. You know they become faults when willTurnIntoFault is invoked. You'll know they'll be deleted when

KVO question

2010-07-01 Thread Rainer Standke
Hello all, is it possible to determine if one object is observing another? Specifically, I'd like one object to ask another are you observing me?. That way I could determine if I need to remove that observer before I let go of the observed object... Thanks,

Re: KVO question

2010-07-01 Thread Kyle Sluder
On Jul 1, 2010, at 8:26 AM, Rainer Standke li...@standke.com wrote: Hello all, is it possible to determine if one object is observing another? Specifically, I'd like one object to ask another are you observing me?. That way I could determine if I need to remove that observer before I let

Re: KVO question

2010-07-01 Thread Rainer Standke
I have a core data app where I don't necessarily know when managed objects go away, as in: become faults, will be deleted etc.. I also need to add the observer to the managed object in awakeFromFetch, but that gets not only called upon opening an existing object, but also later on when fetches

Re: KVO question

2010-07-01 Thread Matt Neuburg
On Thu, 1 Jul 2010 08:26:00 -0700, Rainer Standke li...@standke.com said: Hello all, is it possible to determine if one object is observing another? observationInfo doesn't do this? m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool

Re: KVO question

2010-07-01 Thread Keary Suska
On Jul 1, 2010, at 11:30 AM, Rainer Standke wrote: I have a core data app where I don't necessarily know when managed objects go away, as in: become faults, will be deleted etc.. I also need to add the observer to the managed object in awakeFromFetch, but that gets not only called upon

Basic KVO question

2009-07-01 Thread Tim Schmidt
Hi everyone, first of all, thanks for reading this. I have a basic KVO question. In one of my NIBs I have an NSArrayController and a NSSegmentedControl with add/remove segments for the array of said controller. Now I want to enable the remove-segment according to the controllers canRemove

Re: Basic KVO question

2009-07-01 Thread Keary Suska
On Jun 29, 2009, at 6:09 PM, Tim Schmidt wrote: first of all, thanks for reading this. I have a basic KVO question. In one of my NIBs I have an NSArrayController and a NSSegmentedControl with add/remove segments for the array of said controller. Now I want to enable the remove-segment

Re: Basic KVO question

2009-07-01 Thread Kyle Sluder
On Mon, Jun 29, 2009 at 5:09 PM, Tim Schmidtschmidt@gmx.net wrote: and receive the obligatory change notifications alright, but the change dictionary always contains an NSNull instance for the NSKeyValueChangeNewKey instead of the NSNumber bool subclass I would expect. Am I doing something

Binding/KVO question

2008-12-03 Thread Jean-Nicolas Jolivet
This might be an obvious question but I don't think I've ever had to do it...I'll try to keep the example as simple as possible: I have 2 classes; An AppController with a bunch of properties (lets say propA, probB and probC, all integers) that are bound to my main window's controls...

Re: Binding/KVO question

2008-12-03 Thread Keary Suska
On Dec 3, 2008, at 2:35 PM, Jean-Nicolas Jolivet wrote: In the same NIB file I have a second window with a custom view inside (Let's call it MyCustomView, in MySecondWindow) is there a way for MyCustomView to have properties that will be bound to my AppController's propA, propB and propC

Re: Binding/KVO question

2008-12-03 Thread Kyle Sluder
On Wed, Dec 3, 2008 at 4:35 PM, Jean-Nicolas Jolivet [EMAIL PROTECTED] wrote: An AppController with a bunch of properties (lets say propA, probB and probC, all integers) that are bound to my main window's controls... (all sliders..) when the main windows sliders are changed, the properties of

Re: Binding/KVO question

2008-12-03 Thread Jean-Nicolas Jolivet
Well I'm trying to declare an outlet to my app controller in my custom view but as soon as I added it, the app wouldn't build anymore... (I get 2 errors, one where AppController declares an outlet to my custom view, and one where my custom view declares an outlet to my AppController) Not

Re: Binding/KVO question

2008-12-03 Thread Keary Suska
On Dec 3, 2008, at 3:39 PM, Jean-Nicolas Jolivet wrote: Well I'm trying to declare an outlet to my app controller in my custom view but as soon as I added it, the app wouldn't build anymore... (I get 2 errors, one where AppController declares an outlet to my custom view, and one where my

Re: KVO Question -- Really Simple for Pros

2008-06-28 Thread Owen Yamauchi
On Fri, Jun 27, 2008 at 10:20 PM, Alex Wait [EMAIL PROTECTED] wrote: But I was sure since I have a firstName method and a setFirstName method it would update the textField. I have used IB to bind the value of the textField to the value of the person object and that works when I edit the

Re: KVO Question -- Really Simple for Pros

2008-06-28 Thread Owen Yamauchi
On Fri, Jun 27, 2008 at 11:29 PM, Alex Wait [EMAIL PROTECTED] wrote: I've read what you said but I don't know what to do still. Do I need to implement the method? the -observeValueForKeyPath :ofObject:change:context: method? No. NSTextField implements this already. See below. I am not

Re: KVO Question -- Really Simple for Pros

2008-06-28 Thread mmalc Crawford
On Jun 27, 2008, at 11:29 PM, Alex Wait wrote: What I need to know is what I need to add to get the text field to update whenever firstName is changed. I want it to set the value of its string value to the string. That's explained in the document for which I provided the link... mmalc

KVO Question -- Really Simple for Pros

2008-06-27 Thread Alex Wait
Practicing some KVO concepts. I have this line [person addObserver:textField forKeyPath:@firstName options:NSKeyValueObservingOptionNew context:NULL]; person is App Controller's Person object. textField is a NSTextField person does have a firstName property of type NSString When I click

Re: KVO Question -- Really Simple for Pros

2008-06-27 Thread mmalc crawford
On Jun 27, 2008, at 10:20 PM, Alex Wait wrote: But I was sure since I have a firstName method and a setFirstName method it would update the textField. I have used IB to bind the value of the textField to the value of the person object and that works when I edit the textfield (yay). So I

Re: KVO Question -- Really Simple for Pros

2008-06-27 Thread Alex Wait
could you be more specific that just a link? ;) On Fri, Jun 27, 2008 at 10:23 PM, mmalc crawford [EMAIL PROTECTED] wrote: On Jun 27, 2008, at 10:20 PM, Alex Wait wrote: But I was sure since I have a firstName method and a setFirstName method it would update the textField. I have used IB

Re: KVO question on Tree Controllers

2008-04-01 Thread Adam Gerson
What is bound to your NSTreeController? If its something like an OutlineView you can have the delegate impliment outlineViewSelectionDidChange. I tested it in my app and it does get called when the OutlineView selection is changes to empty. Adam On Tue, Apr 1, 2008 at 3:11 PM, Jeff LaMarche

Re: KVO question on Tree Controllers

2008-04-01 Thread Rob Keniger
On 02/04/2008, at 5:11 AM, Jeff LaMarche wrote: I've also tried using @selectedObjects rather than @selection. Now this notifies me when the selection changes, except it doesn't notify me if the user clicked somewhere resulting in an empty selection, nor when the selection is currently