• 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: invoked when it should not (and without mouseDown)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -mouseDragged: invoked when it should not (and without mouseDown)


  • Subject: Re: -mouseDragged: invoked when it should not (and without mouseDown)
  • From: Graham Cox <email@hidden>
  • Date: Mon, 04 Feb 2013 11:21:33 +1100

On 25/01/2013, at 6:30 AM, Tae Won Ha <email@hidden> wrote:

> Hi, guys. I need some help in event handling. I have a custom view embedded in a scroll view which is embedded in a split view. The window has got a toolbar. When I move the window down by dragging the toolbar, very often the -mouseDragged: of my custom view gets invoked. Curiously enough, it does not seem to happen when I drag the window up. My questions:
>
> - Why?
> - When I NSLog() things, I see that -mouseDown: of the custom view is not invoked. What's going on?
>
> It's the following file
>
> https://github.com/qvacua/qmind/blob/master/Qmind/QMMindmapView.m
>
> from line 706.
>
> I created a dummy project which has got a dummy -mouseDragged: implementation inside a window with a toolbar. In the dummy project it does not happen at all.
>
> I'm clueless. Am I missing something quite simple here? Anybody had similar problems?


Yes, I've seen this happen sometimes - I believe it's a bug.

You can mitigate it by examining the event that you get in the mouseDragged: method - if I recall correctly there is something different about the event that allows you to detect that it's the "wrong" one and ignore it, but I can't pinpoint the exact necessaries in my code, sorry.

Another option is to forget about using mouseDragged: in your custom view and do everything from mouseDown:, including keeping control and fetching and handling events in a loop and do your dragging there. I'm finding that approach often simplifies things a lot and it means you can only fetch the events you need.


--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >-mouseDragged: invoked when it should not (and without mouseDown) (From: Tae Won Ha <email@hidden>)

  • Prev by Date: Interface Builder button appearance
  • Next by Date: Re: Interface Builder button appearance
  • Previous by thread: -mouseDragged: invoked when it should not (and without mouseDown)
  • Next by thread: NSTableView and performClickOnCellAtColumn - cannot make it work
  • Index(es):
    • Date
    • Thread