I hooked up my stepper;
set theValue to hoursStepper's integerValue()
and it does update the text field ok. The text field is bound to the selection in a table along with other checkboxes and controls. The bindings work well, as expected. If I edit the text field and change table selections back and forth, its value is retained. but when I set the value programmatically, from the stepper, It shows Ok but then when the table selection changes away and back again, it goes back to the original value before the stepper’s setting. So the value is not retained by the bindings unless I enter the text manually.
I tried to select the text of the field to maybe make it ‘stick’ but no luck.
Sorry - a lot to say a little.
Any ideas much appreciated, Rob
Easier: control drag from either field to stepper or vice versa and use a take from method.
That’s pretty nice. I’ll use that. unfortunately I still have my problem though - the stepper’s values are retained but the bindings but the text field values always revert to the pre-stepped value.
the table that they are bound to has it’s content bound to a record property and I think somehow that property isn’t getting updated? Really in the dark on this one. i
table’s fault, do it without the direct link, meaning you might need to abandon the take from, dunno Then again I’m know the minimum of bindings it might be a setting.
It goes deeper,
Anything that is set programmatically, whether a text field or checkbox state, will not be retained by the bindings.
This is my old set up:
are all bound to the selection of table 1, so they change as you change the table’s selection to a new row. This has been working well but I am not sure how to approach this now. When you change anything manually, the values are retained but programmatically they are not. I will try to update the view somehow or the record that is bound to everything perhaps… help?
If bindings, you might want a different kind for setting.
Have you bound both the stepper and its text field to the property?
No - they each have their own property. Should I?
I just found a workaround by setting the array controller’s key value for the item. that changes the source so it is retained. but it means:
Backset's arrangedObjects()'s objectAtIndex_(Backset's selectionIndex())'s valueForKey_("opts")'s setValue_forKey_(theValue, "sethours")
which would be a lot simpler. It is starting to look like the old way:
set contents of text field “hoursTextField” of drawer “drawerName” of window “main” to theValue
Should i bind both to the same property? give it a try?
Why do they have their own property? Aren’t they both setting the same value.
The way you are setting it looks right to me.
Good question. i had forgotten to hook up the steppers and then put them on two new properties. Thanks, Rob
This all leads to another question.
I am using bindings to connect my table to the content and the checkboxes etc.
I want to set some of the checkboxes to not-enabled which again I can do programmatically but when selection changes the enabled state is not preserved. In the old ASS app I used 'on selection changed" to update the states of the UI.
How can I implement “on selection changed” for the table or otherwise receive notification of the change?
I can’t seem to find the method anywhere.
In your selection did change handler you need to set the values based on the selection. There is no shortcut to this. You will have to set your properties to the values in the array based on the current selection. Then your UI elements will update correctly.
That’s what I am struggling with: how to set that up. I found this:
- (void) tableViewSelectionDidChange: (NSNotification *) notification
OK _ Just, on a chance, I hooked up the table as delegate to my script and added an outlet, aTableView, for it to the script and it works!
--make my changes in the UI
I also realized i could just add more keys to the array for the enabled aspect of the checkboxes and it should all be automatic, though it will be a long string of key-values.
thanks Craig, Rob
ps really enjoyed the first two movies - keep em coming!