• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: mouseDragged event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mouseDragged event


  • Subject: Re: mouseDragged event
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 22 Jun 2004 23:35:18 -0600

On Jun 22, 2004, at 8:58 PM, James DiPalma wrote:

I have a mouseDown: that does little if an event might start a drag (all mouse events unless a modifier flag exists) and calls [super mouseDown:] otherwise. This technique worked, but it was a challenge to get right especially since mouseUp: needs to be overridden to handle what NSMatrix would have done if it handled a mouseDown: that did not start a drag.

I've been able to break NSMatrix's mouse tracking with a minimum of hacking, and without overriding -mouseUp:. I don't have any sample code on me right now (you can probably find some in the archives), but here's what I did in a NSMatrix subclass' -mouseDown: method...

1. If the Shift or Command keys were held down when the event occurred, then it's OK to just send the message to the superclass and return. It's the easiest way of handling modifier-clicks on cells and doesn't break anything.
2. Call -getRow:column:forPoint: and save the results for the next step. If that method returns YES, then the user clicked on a cell. If it returns NO, then send the event to the superclass.
3. Select the row & column in the usual way.
4. Check the click count. If only one click was in the event, then trigger the matrix's single-click action. If the button was clicked two or more times, then trigger the matrix's double-click action.

That should do it... Then the NSMatrix subclass will receive -mouseDragged: events so you can implement dragging or whatever you want to do in that method.

Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: mouseDragged event
      • From: James DiPalma <email@hidden>
References: 
 >mouseDragged event (From: Rick Bischoff <email@hidden>)
 >Re: mouseDragged event (From: James DiPalma <email@hidden>)

  • Prev by Date: Re: mouseDragged event
  • Next by Date: mixed mode data/audio cd mount point
  • Previous by thread: Re: mouseDragged event
  • Next by thread: Re: mouseDragged event
  • Index(es):
    • Date
    • Thread