how do I save my NSOutlineView items into a file?
how do I save my NSOutlineView items into a file?
- Subject: how do I save my NSOutlineView items into a file?
- From: オウ ショビン <email@hidden>
- Date: Thu, 23 Feb 2006 16:37:52 +0900
I have written the following codes to save my NSOutlineView items.
But when I debug the codes, it seems only the parentNode is saved but
not including those children. I don't know why? I want to know
whether "NSArchier" can used to save outlineView or not, though I
found it can used to save the items of TableView.
And In general, how to save outlineView items.
Thanks for any help.
lepton
------------------------------------------------------------------------
--------------------------
- (IBAction)saveData:(id)sender
{
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setTitle:@"Save NSOutlineView"];
[savePanel beginSheetForDirectory:NSHomeDirectory() file:nil
modalForWindow:myWindow modalDelegate:self
didEndSelector:@selector(didEndSaveSheet:returnCode:contextInfo:)
contextInfo: NULL];
}
-(void) didEndSaveSheet:(NSSavePanel *)savePanel returnCode:(int)
returnCode contextInfo:(void *)contextInfo
{
if(returnCode == NSOKButton) {
NSString *filename = [savePanel filename];
[NSArchiver archiveRootObject:myOutlineItems toFile:filename];
//"myOutlineItems is NSMutableArray that includes all items in
myOutlineView that is ture.
Here for example: myOutlineView only include one column "
[myOutlineView setAutosaveExpandedItems:YES];
}
}
-(void)encodeWithCoder:(NSCoder *)encoder
{
[encoder encodeObject:itemName];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden