Re: Modernising dragging problem

2015-02-02 Thread Markus Spoettl

On 01/02/15 23:06, Graham Cox wrote:



On 1 Feb 2015, at 5:23 am, Markus Spoettl  wrote:

I did the same conversion a while back and have had no such issue. I found it 
completely straight forward and surprisingly painless. Are you sure you're 
implementing all the required protocols?

+ In the view starting dragging NSDraggingDestination (if it wants to receive 
something, too), also are you calling -registeringForDraggedTypes: in that view
+ In you object you're calling "obj" NSPasteboardWriting
+ In the object you're calling "source" NSDraggingSource

In my implementation "obj" and "source" are the same object, but that should 
not matter. Looking at my code, I think that's all the needs to be done.




Hi Markus,

Yes, I'm conforming to all the protocols, and I'm registering for the dragged 
types - actually that pertains to receiving only, but I can drag and receive 
the same types. Temporarily turning off the registering for dragged types (so 
that the same view won't immediately start responding to the drag it started) 
doesn't fix things, so that isn't a cause of what I'm seeing.

It's most odd - nothing is logged that might give a clue. The legacy code still 
works perfectly.


I agree, it's odd. Maybe something wrong with the image (unlikely if the code 
you posted is what you're using and it's working with the old API)? If nothing 
else helps: Did you try turning it off and on again?™


Regards
Markus
--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Modernising dragging problem

2015-02-01 Thread Graham Cox

> On 1 Feb 2015, at 5:23 am, Markus Spoettl  wrote:
> 
> I did the same conversion a while back and have had no such issue. I found it 
> completely straight forward and surprisingly painless. Are you sure you're 
> implementing all the required protocols?
> 
> + In the view starting dragging NSDraggingDestination (if it wants to receive 
> something, too), also are you calling -registeringForDraggedTypes: in that 
> view
> + In you object you're calling "obj" NSPasteboardWriting
> + In the object you're calling "source" NSDraggingSource
> 
> In my implementation "obj" and "source" are the same object, but that should 
> not matter. Looking at my code, I think that's all the needs to be done.
> 


Hi Markus,

Yes, I'm conforming to all the protocols, and I'm registering for the dragged 
types - actually that pertains to receiving only, but I can drag and receive 
the same types. Temporarily turning off the registering for dragged types (so 
that the same view won't immediately start responding to the drag it started) 
doesn't fix things, so that isn't a cause of what I'm seeing.

It's most odd - nothing is logged that might give a clue. The legacy code still 
works perfectly.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Modernising dragging problem

2015-01-31 Thread Markus Spoettl

On 31/01/15 00:15, Graham Cox wrote:

I'm updating some older code that uses the now-deprecated [NSView
dragImage:at:offset:pasteboard:source:slideback:] to use NSDraggingSession
and pals. Note that this older code works just fine, I've never had any
issues with it. I'm doing this mostly just to clear out compiler warnings,
though my instinct tells me not to "fix" code that isn't broken.

Sadly its replacement is broken.


I did the same conversion a while back and have had no such issue. I found it 
completely straight forward and surprisingly painless. Are you sure you're 
implementing all the required protocols?


+ In the view starting dragging NSDraggingDestination (if it wants to receive 
something, too), also are you calling -registeringForDraggedTypes: in that view

+ In you object you're calling "obj" NSPasteboardWriting
+ In the object you're calling "source" NSDraggingSource

In my implementation "obj" and "source" are the same object, but that should not 
matter. Looking at my code, I think that's all the needs to be done.


Regards
Markus
--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Modernising dragging problem

2015-01-30 Thread Graham Cox

> On 31 Jan 2015, at 10:25 am, Kyle Sluder  wrote:
> 
> Does the source implement the required method -[
> draggingSession:sourceOperationMaskForDraggingContext:]? This is the new
> replacement for -draggingSourceOperationMaskForLocal:.


Ah, thanks - It wasn't - but having corrected that, it hasn't fixed my issue.

I've also checked whether the immediate return of the new method would cause a 
problem (e.g. if the caller were doing stuff after starting the drag that was 
assuming the drag had completed). It's not - in fact it's just being called 
from a simple -[NSView mouseDown:] event handler with no other code.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Modernising dragging problem

2015-01-30 Thread Kyle Sluder
On Fri, Jan 30, 2015, at 05:15 PM, Graham Cox wrote:
> In order to use NSDraggingItem, I first need to make sure the stuff I'm
> dragging supports NSPasteboardWriting. I've done that, it seems
> straightforward enough. Then I build a NSDraggingItem and use the same
> image I previously used, so there's nothing new there. Finally I use
> [NSView beginDraggingSessionWithItems:event:source:].
> 
> Nothing shows up. No image, nothing drags. I can break on the
> NSPasteboardWriting methods and see that they are being called, so it
> seems to be trying to write the correct things to the pasteboard. Nothing
> is logged. After this, use of the legacy dragging methods elsewhere in
> the app also fail to work - it's like whatever I did in this drag session
> messes up the dragging system altogether. Obviously I'm doing something
> wrong, but I've been over the docs and am just not getting it.

Does the source implement the required method -[
draggingSession:sourceOperationMaskForDraggingContext:]? This is the new
replacement for -draggingSourceOperationMaskForLocal:.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com