• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)


  • Subject: Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)
  • From: Nathan Vander Wilt <email@hidden>
  • Date: Thu, 20 Mar 2008 16:09:43 -0700

On Mar 20, 2008, at 3:31 PM, Dave Hersey wrote:
Do you get anything different if you print the object as a pointer (%p)? Printing it as an int value is... weird.

Try:

printf("Dragged Image: %p\n", (void *)[sender draggedImage]);

That's a useful format I'd either forgotten or never known, thanks! I was just casting to an int to get rid of the warning for the hex, though. (In C casts are pretty weak.) Now from all three methods I always get:
Dragged Image: 0x0
...which is prettier, but still doesn't explain why the return value is always nil. Or why Sherm's car wouldn't start.


If this is a bug, it seems to have been around since before 2004. (See list of unanswered links in OP.) If it's a documentation omission, nobody seems to know what the docs *should* say, also since 2004. If it's user error, I'll still blame the docs, but at least I can make my bug report better!

Maybe this would be a better way of asking:

What is the NSDraggingInfo protocol's -draggedImage method supposed to return, and under what circumstances?

thanks,
-natevw



On Mar 20, 2008, at 6:15 PM, Nathan Vander Wilt wrote:
...
I subclassed an NSImageView to turn it into a dropbox to help me prototype a file-opening feature.


I implemented the following method in my DropBox class:

- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
	printf("Dragged Image: %x\n", (NSUInteger)[sender draggedImage]);
	return NSDragOperationLink;
}

When I hover any file/folder from the Finder over this drop box, I get:
Dragged Image: 0
in the debugging console. Likewise if I check it in my prepare/ performDragOperation, this value is always nil.


The documentation says nothing about this method ever returning nil, so it's even more suprising to me that it would *always* return nil. I would expect it to give back a reference to the file/ folder icon image that I'm dragging around underneath the cursor. Is that not what this method is documented to do?

thanks,
-natevw

_______________________________________________

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


  • Follow-Ups:
    • Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)
      • From: "Sherm Pendley" <email@hidden>
References: 
 >yearly NSDraggingInfo -draggedImage question (BEWARE!) (From: Nathan Vander Wilt <email@hidden>)
 >Re: yearly NSDraggingInfo -draggedImage question (BEWARE!) (From: "Sherm Pendley" <email@hidden>)
 >Re: yearly NSDraggingInfo -draggedImage question (BEWARE!) (From: Nathan Vander Wilt <email@hidden>)
 >Re: yearly NSDraggingInfo -draggedImage question (BEWARE!) (From: Dave Hersey <email@hidden>)

  • Prev by Date: Simple messages problem
  • Next by Date: doubleValue (for an NSString)
  • Previous by thread: Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)
  • Next by thread: Re: yearly NSDraggingInfo -draggedImage question (BEWARE!)
  • Index(es):
    • Date
    • Thread