Drag an drop in a custom NSView
Drag an drop in a custom NSView
- Subject: Drag an drop in a custom NSView
- From: Development <email@hidden>
- Date: Tue, 9 Oct 2007 12:05:45 -0700
Ok,
I have constructed a subclass of NSView so that I can set the delegate.
Anyway. The NSView Subclass contains a bunch of subviews which are
NSButtons. I am having two problems though with drag and drop. I
registered for drag types, both file names and a custom internal type
like I normally do with outline views. However i get no focus ring
nor does it seem I get any reaction at all when I drag a file to the
view. I've tried registering the enclosing scroll view for drag
types, but still nothing. So basically its obvious I don't know how
to tell the view to detect the drag, or if I have, I don't know how
to gain the data from the drag.
The other problem is in the view containing NSButtons. Each button is
inside an NSView however if I add the nsviews to the subclass of
NSView I've been using inside the scroller then I get nothing at all,
so I have to create the button, and then only add it. This makes it
impossible to drag the buttons. However I need to be able to drag the
buttons, or at least represent dragging them, so that the files they
correspond to can be moved to new folders.
I tried to use just an NSImageView instead of buttons but I couldn't
seen to get it to accept mouse clicks which I also need it to do so
that I can have the file represented open on the screen.
Does any one know of some information on doing this (if i've made
clear what I'm trying to do.) or maybe so examples? I've spent the
last couple of hours on the developer site and google and cannot find
anything that appears relevant.
The only other alternative I see is to use a tableview and monkey
with the row heights so I can display the document thumbs...
something I dont want to do.
Thanks
_______________________________________________
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