Instance Method

browser:validateDrop:proposedRow:column:dropOperation:

Sent to the delegate during a dragging session to determine whether a drop should be accepted and to obtain the drop location. This method is required for a browser to be a drag destination.

Declaration

- (NSDragOperation)browser:(NSBrowser *)browser validateDrop:(id<NSDraggingInfo>)info proposedRow:(NSInteger *)row column:(NSInteger *)column dropOperation:(NSBrowserDropOperation *)dropOperation;

Parameters

browser

The browser.

info

The drag session information.

row

On input, the proposed drop row. On output, the drop row.

column

On input, the proposed drop column. On output, the drop column.

dropOperation

On input, the proposed drop location. On output, the drop location.

Return Value

The drag operation that the data source is to perform. For the browser to accept the drop, it must not be NSDragOperationNone.

Discussion

The browser proposes a drop column, row, and row-relative location for the drop based on the pointer position, as shown in this table:

Drop relative location

Description

NSBrowserDropOn

Dragging location (dragInfo.draggingLocation) is closer to the middle of row than to either of its vertical sides.

NSBrowserDropAbove

Dragging location is between two rows. Indicates a drop location above row and below row - 1.

These are a few examples of how to specify a drop location:

Row index

Row-relative location

On row 2

2

NSBrowserDropOn

Between rows 2 and 3

3

NSBrowserDropAbove

Below the last row

[sender numberOfRows]

NSBrowserDropAbove

All rows

-1

NSBrowserDropOn

See Also

Dragging

- browser:canDragRowsWithIndexes:inColumn:withEvent:

Sent to the delegate to determine whether the browser can attempt to initiate a drag of the specified rows for the specified event.

- browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:

Sent to the delegate to obtain an image to represent dragged rows during a drag operation on a browser.

- browser:acceptDrop:atRow:column:dropOperation:

Sent to the delegate during a dragging session to determine whether to accept the drop.

- browser:writeRowsWithIndexes:inColumn:toPasteboard:

Determines whether a drag operation can proceed. This method is required for a browser to be a drag source.