RFC: NSOutlineView folders don't spring open during drag (solved!)
RFC: NSOutlineView folders don't spring open during drag (solved!)
- Subject: RFC: NSOutlineView folders don't spring open during drag (solved!)
- From: Jerry Krinock <email@hidden>
- Date: Tue, 12 Sep 2006 18:56:23 -0700
- Thread-topic: RFC: NSOutlineView folders don't spring open during drag (solved!)
At long last, I have finally succeeded in giving the user the choice whether
or not they want destination containers in my NSOutlineView to spring open
as they mouse over them. Built-in NSOutlineView behavior is that they
ALWAYS spring open, which many users (and Cocoa programmers) find to be
annoying.
I plan to release this tomorrow. Any comments?
The implementation begins with Fabien Conus' idea:
http://www.cocoabuilder.com/archive/message/cocoa/2004/9/15/117503
but, to solve the problem that he mentioned at the end of his post, which is
that springing is not re-enabled if the user does not conclude the drag, I
set an NSTimer to do this after 300 milliseconds. Also, instead of using a
"global" BOOL to enable/disable spring loading, I use an instance variable
in my subclass of NSOutlineView.
The user inhibits folders springing open by holding down the 'shift' key. I
chose 'shift' because:
'opt' is used during drag to indicate a copy
'ctrl' is used during drag to indicate a link
'cmd' is used during selection for discontiguous selection, but
not during drag. However, when the cmd key is down, the
NSDragOperation I get in outlineView:acceptDrop:item:childIndex
is NSDragOperationNone. To fix this would require a kludgey
workaround.
'shift' is used during selection for contiguous selection, but
not during drag. And it does not interfere with the
NSDragOperation provided to
outlineView:acceptDrop:item:childIndex, so no kludgey
workaround is needed.
The 'opt' and 'shift' key operations are thus independent of each other.
A tip pops up during drags to explain what these modifier keys do.
Jerry
_______________________________________________
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