I have NSButton what accepts drop on to add dragged items to NSMutableArray. How can I make drag from NSButton to drag all items in NSMutableArray?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way to do that is to use the NSView method, dragImage:at:offset:event:pasteboard:source:slideBack: to start the drag. In your custom button class you would override mouseDown: and call that method. I wrote an example where the image that’s dragged is the button’s image, and the data I’m dragging is just the string “ARRAY”. That should be all you need to do from the source side — when you drop that on your destination, it could test to see if what was dropped was the string “ARRAY” and then do whatever you want to do with that array you created with your first drop. I used the NSMultipleDocuments image in my button, and I make it disappear when I drag out of the button.