Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7905989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:43:03+00:00 2026-06-03T10:43:03+00:00

I have NSButton what accepts drop on to add dragged items to NSMutableArray. How

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:43:05+00:00Added an answer on June 3, 2026 at 10:43 am

    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.

    - (void)mouseDown:(NSEvent *)theEvent {
         NSImage *pic = self.image;
         NSSize dragOffset = NSMakeSize(0.0, 0.0);
         NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
        [pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType]  owner:self];
        [pboard writeObjects:[NSArray arrayWithObject:@"ARRAY"]];
        NSPoint btnMiddle = NSMakePoint(self.frame.size.width/2,self.frame.size.height/2);
        NSPoint picOrigin = NSMakePoint(btnMiddle.x - pic.size.width/2, btnMiddle.y + pic.size.height/2);
        self.image = nil;
        [self dragImage:pic at:picOrigin offset:dragOffset event:theEvent pasteboard:pboard source:self slideBack:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From what I have learned so far: In Objective-C you can send any message
I have created a subclass of NSButton. Is it possible to add the GUI
I have two nsbuttons in my interface builder.For all of these three nsbuttons I
Have someone tried out DeCAL in Delphi 2009? I'm thinking about upgrading from 2007,
have not tested on windows. but in ubuntu when u disconnect from the network,
Have converted devise new session from erb to Haml but doens't work, this is
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:
Have a rather abstract question for you all. I'm looking at getting involved in
I have written a timer application that passes a speechTime from an IBAction and
have been trying couple of hours now to make my iphone app universal. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.