FROM : Chris Hanson
DATE : Sun Apr 20 06:55:23 2008
On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
> I have two NSTableViews, tableA and tableB, each managed by separate
> NSArrayControllers. When a selection is made in either table, an
> instance
> variable is set. I want to have an NSButton's enabled state to 'YES'
> whenever the instance variable is set.
Don't think of it as an instance variable, think of it as a property.
Restating your problem, you want your "Do Something" button's enabled
property to be bound to your window controller's "can do something"
property.
What this means is that you need to manipulate your window
controller's "can do something" property in a way that things bound to
it can notice -- in other words, in a way that will post key-value
observing notifications. Thus instead of manipulating it as an
instance variable, you should just always invoke its setter.
You haven't said how you're actually noticing that the selection in
one of your tables has changed; I assume you're either using an
NSTableView delegate method or a notification to do so.
-- Chris
DATE : Sun Apr 20 06:55:23 2008
On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
> I have two NSTableViews, tableA and tableB, each managed by separate
> NSArrayControllers. When a selection is made in either table, an
> instance
> variable is set. I want to have an NSButton's enabled state to 'YES'
> whenever the instance variable is set.
Don't think of it as an instance variable, think of it as a property.
Restating your problem, you want your "Do Something" button's enabled
property to be bound to your window controller's "can do something"
property.
What this means is that you need to manipulate your window
controller's "can do something" property in a way that things bound to
it can notice -- in other words, in a way that will post key-value
observing notifications. Thus instead of manipulating it as an
instance variable, you should just always invoke its setter.
You haven't said how you're actually noticing that the selection in
one of your tables has changed; I assume you're either using an
NSTableView delegate method or a notification to do so.
-- Chris
| Related mails | Author | Date |
|---|---|---|
| Lorenzo Thurman | Apr 19, 20:08 | |
| Chris Hanson | Apr 20, 06:55 | |
| Lorenzo Thurman | Apr 20, 19:47 | |
| Keary Suska | Apr 20, 22:02 | |
| Lorenzo Thurman | Apr 21, 15:40 | |
| Lorenzo Thurman | Apr 21, 15:58 |






Cocoa mail archive

