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
@MainActor optional func browser(_ browser: NSBrowser, validateDrop info: any NSDraggingInfo, proposedRow row: UnsafeMutablePointer<Int>, column: UnsafeMutablePointer<Int>, dropOperation: UnsafeMutablePointer<NSBrowser.DropOperation>) -> NSDragOperationParameters
- 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 |
|---|---|
Dragging location ( | |
Dragging location is between two rows. Indicates a drop location above |
These are a few examples of how to specify a drop location:
Row index | Row-relative location | |
|---|---|---|
On row 2 |
| |
Between rows 2 and 3 |
| |
Below the last row |
| |
All rows |
|