Re: Why does NSImageView Mask the Drop Zone of a Subview
Re: Why does NSImageView Mask the Drop Zone of a Subview
- Subject: Re: Why does NSImageView Mask the Drop Zone of a Subview
- From: glenn andreas <email@hidden>
- Date: Wed, 10 May 2006 10:48:08 -0500
On May 10, 2006, at 10:09 AM, Jerry Krinock wrote:
I'm trying to make a "File Drop" subview into which files can be
dropped.
This is similar to Seth Willits' FileDropView and Apple's
CocoaDragAndDrop,
but since I need a lot of these, I've expanded it into a subview
with two
outlets:
IBOutlet NSImageView* image ; // Shows image of file
IBOutlet NSTextView* label ; // Shows name of file
My only problem is that the frame of the NSImageView is excluded
from my
subview's drop zone. That is, my drop zone has a hole in the
middle; I get
draggingExited: when the mouse enters the frame of the NSImageView.
This does not happen when the mouse enters the frame of the
NSTextView, (or
that of an NSButton, which I experimented with).
What's so special about the NSImageView? It is "enabled".
NSImageView already has support for drag & drop built in, which is
what you're seeing (since when dropping, AppKit finds the "deepest"
view under the mouse that deals with the drop).
One possible solution is to use a borderless NSButton (set to display
an image but no title) to display the image instead of an
NSImageView. Depending on how you want the things drawn, you could
probably just use a subclass of NSButton that has your drag & drop
logic built into it (since it would provide things like hilight and
tracking if you needed that for you).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures,
fractals, art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden