Re: NSTableView drop refuse or redirect

Kevin Reid <[email protected]> Mon, 17 May 2010 10:27:58 -0400
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On May 17, 2010, at 5:27, Christiaan Hofman wrote:

> I have a question about best practices to handle drag&drop on table  
> views. Often I want to support only drops in certain positions. For  
> instance, lets say I only want to support insertions  
> (NSTableViewDropAbove) and not drop on (NSTableViewDropOn). I can do  
> two things when I get an NSTableViewDropOn in - 
> tableView:validateDrop:proposedRow:proposedDropOperation:. One is to  
> simply refuse the drop (return NSDragOperationNone), the other is to  
> redirect the drop to an NSTableViewDropAbove using  
> setDropRow:dropOperation:. The question is what the proper way is to  
> handle such invalid drops?

Speaking as a user, what I want is for the largest possible area to  
serve as a useful drop target. I know that it is possible for a  
NSTableView to be configured such that dragging to any vertical  
position produces an insertion target of whichever space-between-rows  
is closer to the mouse (but not offhand what produces that) — do  
whatever gives that result.

-- 
Kevin Reid                                  <http://switchb.org/kpreid/>