Re: NSTableView
Re: NSTableView
- Subject: Re: NSTableView
- From: Arved von Brasch <email@hidden>
- Date: Mon, 22 Apr 2019 05:39:56 +1000
Yeah, it was obvious that writeRowsWith: would soon be deprecated. After going
through the documentation a bit, I did it via:
func tableView(_ tableView: NSTableView, draggingSession session:
NSDraggingSession, willBeginAt screenPoint: NSPoint, forRowIndexes rowIndexes:
IndexSet) {
session.enumerateDraggingItems(options: .concurrent,
for:
nil,
classes: [NSPasteboardItem.self],
searchOptions: [:],
using: { (draggingItem, index, stop) in
// Generate Image
let canvas = NSImage.init(size: canvasSize)
draggingItem.setDraggingFrame(NSMakeRect(session.draggingLocation.x,
session.draggingLocation.y, canvas.size.width, canvas.size.height), contents:
canvas)
})
}
> On 21 Apr 2019, at 19:03, Alex Zavatone <email@hidden> wrote:
>
> What is the alternative, then?
>
> If single image drags will not work because of this, is there a means to
> impersonate another method?
>
> Oh, and greets from the coast of Africa. Cheers,
> Alex Zavatone
>
> Sent from my iPhone
>
>> On Apr 20, 2019, at 10:17 AM, Rob Petrovec <email@hidden> wrote:
>>
>> Because dragImage is the old (and likely soon to be deprecated), single
>> image style drag setup and the pasteboardWriter version is the modern
>> multi-image drag set up. Ever notice how when you drag a file around in the
>> Finder the drag image will morph as the drag moves between windows with
>> different view styles etc? Or how the drag images change positions relative
>> to the mouse as you drag multiple files around. That is the multi-image
>> drag setup. Single image drags can’t do that.
>>
>> —Rob
>>
>>
>>> On Apr 20, 2019, at 12:14 AM, Arved von Brasch <email@hidden> wrote:
>>>
>>> Hello list,
>>>
>>> Anyone know if it is intentionally the case that NSTableView doesn’t call
>>>
>>> dragImageForRows(with dragRows: IndexSet, tableColumns: [NSTableColumn],
>>> event dragEvent: NSEvent, offset dragImageOffset: NSPointPointer) -> NSImage
>>>
>>> if you implement
>>>
>>> func tableView(NSTableView, pasteboardWriterForRow: Int) ->
>>> NSPasteboardWriting?
>>>
>>> instead of
>>>
>>> func tableView(NSTableView, writeRowsWith: IndexSet, to: NSPasteboard) ->
>>> Bool
>>>
>>> I can’t see a reason for it not to in the documentation, but it doesn’t in
>>> my code.
>>>
>>> Kind regards,
>>> Arved
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> 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:
>>>
>>> This email sent to email@hidden
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden