Re: Checkbox Mayhem
Re: Checkbox Mayhem
- Subject: Re: Checkbox Mayhem
- From: "Frank D. Engel, Jr." <email@hidden>
- Date: Sun, 18 Dec 2016 07:50:08 -0500
Ok, I think I'm getting closer to understanding this:
When I add new rows to the table, I can update the checkboxes before
exiting the application, and the values stick (though the enabled state
of "a" does not change when I toggle "b").
When I re-open the application after that, the enabled state of "a"
reflects the state of "b" when I closed the application, and then the
behavior described below is in effect for that row - I can toggle the
checkboxes, but when I then exit and re-open the application, they have
their old values.
There is also a string which is displayed in the row. If I modify the
checkbox then edit that string before closing and re-opening the
application, the change to the checkbox is in effect, and the enabled
state of "a" gets updated.
It seems as if toggling the checkbox is somehow not informing core data
that the value was changed, and the binding does not get triggered to
update the enabled state, but when I edit the string, it knows that the
object changed, so it then saves the checkbox state before exiting?
With this, I tried removing the "a" and "b" keys from the @synthesize
line and created my own accessors after declaring the primitive
accessors, and now everything seems to be working.
My guess is that for some reason the @synthesize methods are not calling
"willChangeValueForKey" and the like - why would that be the case? I
have worked on one or two other Core Data projects and I don't remember
having to do this before...
On 12/18/2016 06:41, Frank D. Engel, Jr. wrote:
Hoping this is something simple that is simply escaping me at the
moment...
I a view-based table with two columns containing checkboxes.
The table has its content property bound to an array controller's
arrangedObjects, with that array controller being tied to entities in
Core Data.
The checkboxes are each bound to Table Cell View.objectValue.something
(let's say one of them is bound to "a" and the other to "b"), where
those are properties of the entity.
Left like that, everything was working.
However, I want one of the checkboxes to be disabled when the other
one is checked.
To do this, I tried what I thought was obvious: I bound the Enabled
property of the checkbox bound to "a" to Table Cell View.objectValue.b
- since I already had data populated, on the surface, this seemed to
work right upon launch - however:
Changing the checkbox bound to "b" does not change the enabled state
of the one for "a", and does not seem to get saved (this is a
NON-document-based application) - when I relaunch the application, the
checkbox is back to where it was before I exited. I can create new
rows in the table (new objects tied to the entity), and that works
just fine, but checking the boxes does not have any permanent effect.
This is on Mac OS X 10.10.5.
What am I missing here?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden