Triggering a Core Data Store action ...
Triggering a Core Data Store action ...
- Subject: Triggering a Core Data Store action ...
- From: thx316 <email@hidden>
- Date: Sat, 5 Feb 2011 17:00:41 -0500
Hello.
How do I trigger a Core Data Store action when importing the contents of a
standard .txt file into an NSTextView via NSOpenPanel?
This is how I write the contents of a file to the textView. The text does
not remain associated with the sourceView entry, and I cannot save this
contents of the textView. However If I paste text into the textView or type
text, everything works as expected. I'm binding the textView's Value to the
array controller, the attribute is a String. I also tried setting the
textView's attribute to Binary using the Data binding. I am able to
retain/save data with various objects in my application except for the
imported text.
thx.
-(IBAction)doOpen:(id)sender
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setRequiredFileType:@"txt"];
if ([panel runModal] == NSOKButton) {
NSString *fileName = [panel filename];
if ([[fileName pathExtension] isEqualToString:@"txt"]) {
[textView readRTFDFromFile:fileName];
theFormat = PlainText;}
}
return;
_______________________________________________
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