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

  • SEARCH
  • Home
  • 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 7651525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:31:45+00:00 2026-05-31T11:31:45+00:00

I have a NSCollectionView , that displays some files: What I want is… being

  • 0

I have a NSCollectionView, that displays some files:
enter image description here

What I want is…

  1. being able to select one file.
  2. being able to drag this file and drop it on the desktop or another Finder window.

The file icons are displayed by a NSImageView.

What would be a good approach to provide such functionality?

Thanks a lot!

  • 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-05-31T11:31:46+00:00Added an answer on May 31, 2026 at 11:31 am

    You need to call declareTypes:owner: on the collection view and pass in the pasteboard types that you want to be able to drag. In your case you want NSURLPboardType.

    All you need to do then is to implement the three dragging-related delegate methods in your NSCollectionView‘s delegate.

    You should return YES from this method:

    collectionView:canDragItemsAtIndexes:withEvent:

    You can return a custom drag image for each item using this method:

    collectionView:draggingImageForItemsAtIndexes:withEvent:offset:

    And you write the items to the pasteboard using this method:

    collectionView:writeItemsAtIndexes:toPasteboard:

    In your case, you would write the URL for the dragged item to the pasteboard in your implementation of this method.

    If you don’t understand how to work with the pasteboard you should read the guide Drag and Drop Programming Topics.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a simple form that has a PictureBox in one location. I want to
I have an NSCollectionView that contains a collection of CustomViews . Initially it tiled
I have a basic Cocoa app with a custom NSCollectionView that overrides drawRect: to
I have a working NSCollectionView with one minor, but critical, exception. Getting and highlighting
Have I in some way delete this Task or it is self-destroyed? Task.Factory.StartNew(() =>
I'm trying to set up an NSCollectionView (I have done this successfully in the
I have a button that is inside a view repeated inside a NSCollectionView. I
Have a photography site that I want to prevent image copying from. How can
I have an NSCollectionView that lists items from a Core Data source. Each item
So I have an NSCollectionView that has a list of songs. When I update

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.