Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
I have a NSTextView that is binded with coredata. When text is entered, it is not always passed on to the backend when the user does something else. This results in the loss of the data entered. Is there someway to force the nstextview to save the data every time it's changed by the user, without having to resort to delegate methods and manually updating the nsmanagedobject? That would nullify the idea behind bindings, or not.
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
MrFusion said:
I have a NSTextView that is binded with coredata. When text is entered, it is not always passed on to the backend when the user does something else. This results in the loss of the data entered. Is there someway to force the nstextview to save the data every time it's changed by the user, without having to resort to delegate methods and manually updating the nsmanagedobject? That would nullify the idea behind bindings, or not.
Personally, it sounds like you don't have it binded correctly then. Cause any data you add or remove should stay there. That's just my thought on it...

EDIT: You just helped me out with my app, thanks, here's a screenshot of it:
 

Attachments

  • Picture 2.png
    Picture 2.png
    47.4 KB · Views: 130

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
slooksterPSV said:
Personally, it sounds like you don't have it binded correctly then. Cause any data you add or remove should stay there. That's just my thought on it...

EDIT: You just helped me out with my app, thanks, here's a screenshot of it:
You're welcome. :)
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
caveman_uk said:
Is it only saving the data when you tab away from the text view? If so, you need to check the 'continuously updates value' checkbox.
Actually, that just duplicates the value's in the textview - at least it did for me. - What's its type? Is it Binary Data? It has to be Binary Data for it to work.

Other q?s = is it Document-based? Is it based on a selection for the text? e.g. a table selection.
 

caveman_uk

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
My textviews were bound to objects in a dictionary (so not core data) and checking that box made sure the users edits were saved (otherwise the edits are not recorded unless the user moves the focus to another control)
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
caveman_uk said:
My textviews were bound to objects in a dictionary (so not core data) and checking that box made sure the users edits were saved (otherwise the edits are not recorded unless the user moves the focus to another control)
See that's how mine works.

That has me think of another question - what are the actions to produce the result:
e.g. User types in box, user clicks on a different application, user changes a property in an NSSheet, user goes back to data and data is gone.

Give us the exact steps, that'll help us out.
 

MrFusion

macrumors 6502a
Original poster
Jun 8, 2005
613
0
West-Europe
slooksterPSV said:
See that's how mine works.

That has me think of another question - what are the actions to produce the result:
e.g. User types in box, user clicks on a different application, user changes a property in an NSSheet, user goes back to data and data is gone.

Give us the exact steps, that'll help us out.

I found a fix for it. But this is what happend:
I have two views, with a button to switch between them. This is done with addsubview and removefromsuperview.

The textview was in one of the views. When the user types in text and then clicks on the switch button (the focus is still on the textview) the typed in text is lost. When the user first clicks somewhere else, the text is saved.

I solved it by adding these lines before I switch from the view with the textview to the view without it.

[[myArrayController selection] setvalue:[[[myTextview stringvalue] copy] autorelease] forkey:mad:"theText"];

Without the copy the text doesn't get retained, and without the autorelease it leaks.

Yes, the bindings are fine, and the 'cont. update' is also checked.

Thanks for the replies.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.