I have an NSOutlineView subclass bound to a NSTreeController subclass which
is bound to a simple data model representing a hierarchical tree structure.
I've implemented drag and drop by having the view send a custom message to
my NSTreeController subclass who then updates the model. The problem is that
there is then a delay of about 1 second before the view displays the added
node.

I've noticed that if I move the mouse out of the OutlineView, then it seems
to update immediately. Any idea what I maybe doing wrong? Is it possible
that core data and all the observing patterns are really taking this long to
percolate the change back to the view? Am I supposed to do something to wake
up the view faster?

I'm using Leopard (10.5.2), XCode 3, Objective-C 2.0. I don't have any code
to deal with memory management. If I run with garbage collection
unsupported, the OutlineView never updates UNTIL I move the mouse out of the
OutlineView. If garbage collection is enabled, there is the 1 second delay.
With garbage collection supported, there are no errors or exceptions listed
in the console.

MyOutlineView has the following method

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {

    NSPasteboard *pboard;

    NSDragOperation sourceDragMask;

     sourceDragMask = [sender draggingSourceOperationMask];

    pboard = [sender draggingPasteboard];

 if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {

        NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];

if (myTreeController != NULL) {

[myTreeController addFiles:files];

}

}

    return YES;

}

MyTreeController method is as follows:

- (void)addFiles:(NSArray *)droppedFilenames {

NSManagedObjectContext *moc = [self managedObjectContext];

for (NSString *name in droppedFilenames) {

NSManagedObject *bfile = [NSEntityDescription
insertNewObjectForEntityForName:@"bFiles" inManagedObjectContext:moc];

[bFile setName: name];

}

}


The model is:

Entity name: bFiles

Attribute: name

relationship: parent, optional, bFiles

relationship: child,  optional, bFiles


I have MyTreeController nib configured with the following attributes

Keypaths: children = children

Options: avoid empty selection, preserve selection, select inserted objects

ObjectController:

Mode=Entity

Entity name = bFiles

Prepares content, editable


I have MyTreeController bound as follows:

Parameters, ManagedObjectContext

bind to File's Owner

Model key path = managedObjectContext

Raises for not applicable keys


I don't have my NSOutlineView bound to anything but I do have the contained
TableColumn bound as follows:

Value: bind to: Tree Controller

Controller Key = arrangedObjects

Model Key Path = name

Allows editing multiple value selection

Creates sort descriptor

Raises for not applicable keys


Thats about everything pertinent that I can think of. Any suggestions
appreciated.
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to