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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to