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 374157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:22:42+00:00 2026-05-12T14:22:42+00:00

I have a collection view that I’ve subclassed that allows me to reorder the

  • 0

I have a collection view that I’ve subclassed that allows me to reorder the collection view items via drag and drop. My drag code that sets up the pasterboard is currently in mouseDragged:

- (void)mouseDragged:(NSEvent *)aEvent {

    if(!dragInProgress) {
        dragInProgress = YES;

        NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];        

            ... setup pboard, declare types, setData ...
            ... create drag image ....

        [self  dragImage: image
                      at: position
                  offset: NSZeroSize
                   event: aEvent
              pasteboard: pboard
                  source: self
               slideBack: YES];
    }
}

I would like to only initiate a drag if the user has dragged for a certain length, so they don’t initiate a drag accidentally. Is there a setting to do this in Cocoa, or do I need to move this code to mouseMoved: and check the distance between where the drag started and where the mouse is currently?

  • 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-12T14:22:42+00:00Added an answer on May 12, 2026 at 2:22 pm

    In mouseDown:, remember where the mouse went down (locationInWindow). In mouseDragged:, subtract the location of the mouse-down event from the location of the mouse-dragged event, and compare the difference to the size returned by HIMouseTrackingGetParameters with the kMouseParamsDragInitiation selector.

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

Sidebar

Related Questions

I have a JSF view that lists items in a collection in a Primefaces
I have a view that's doing a fetch() to a collection and returning some
I have a Backbone View that has a Collection as its Model. If the
I currently have a view that contains a ListBox bound to a a collection
I have a view that render itself from a Collection: render: function() { $(this.el).html(JST['templates/menu']({collection:
I have a datagrid view that is bind to a custom collection. I have
I have an MVC3 View that's posting back a set of input values via
I have an MVC razor view that iterates over an Orders collection. Each order
I have a button on a view that is bound via a RoutedUICommand to
I have a Collection View Source (CVS) implemented much like you see in MSDN

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.