On Oct 27, 2009, at 12:49 AM, Don Altman wrote: > Hi, > > Does anyone have any insight as to how one could interrupt the auto-expansion > of an item of an NSOutlineView instance? This occurs after a drag operation > enters the item's display area without leaving, for some predetermined time. > The item's outlineView:child:ofItem: method will then be triggered. For a > given folder, this operation might be very time-consuming, especially if the > folder has many children. I'd like to provide a way for the user to cancel > that operation (say, by moving outside the item's display area before its > children have been displayed). It seems that the outlineView:child:ofItem: > method supersedes event handling, so it's difficult to conceive of a > mechanism for the user to communicate their intention of canceling the > auto-expansion.
Please log a bug request asking for more ability to control auto expansion. Ideally, your outlineView:child:ofItem: method should not take a long time. Return something, maybe 0 children, and compute the real children in a background thread. When it is done, reload the item. This is how Finder and the Open and Save panel do this. > > The NSDraggingDestination protocol has a draggingEnded: method, which the > documentation says can be used to cancel auto-expansion of a drag destination. This may be a documentation bug. Can you point me to the location where you read this? > But the method is one of those unimplemented methods, and I've verified that > it's never called. In any case, I don't understand how the method could be > called. When I log the NSDraggingDestination method calls, they are suspended > during the outlineView:child:ofItem: execution. That would be because > everything's running in the same thread. Can anyone think of a way to make > the drag event handling and the NSOutlineView NSOutlineViewDataSource methods > run in different threads? See my above suggestion. Ultimately, your users also have the same problem when simply expanding the item, so it isn't an issue related to just auto-expansion. An alternative is to say "NO" from -shouldExpandItem: when dragging is happening. You can determine when a drag is happening based on the NSDraggingDestination protocol methods implemented by NSOutlineView (subclass, and override to add your own hooks). corbin > > This seems to be an instance of a compute intensive operation without a way > of canceling it, short of doing my own mouse tracking and forgoing the use of > the NSDraggingDestination protocol and auto-expansion in NSOutlineView. > > Thanks for any insights you might provide. _______________________________________________ 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