• 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
Locating a contextual menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Locating a contextual menu


  • Subject: Locating a contextual menu
  • From: Thomas Davie <email@hidden>
  • Date: Sun, 9 Jan 2011 13:58:42 +0000

Heya,

I'd like in my app to be able to position an item by right clicking, and selecting something from a contextual menu.  I'm struggling with this though, I don't see any way to find the position of the click that caused the contextual menu to appear.

Things I've tried:
1) using standard responder like stuff to find the last click in the view, and memorise it.  Unfortunately, NSView eats the right click that causes the contextual menu popup so you never get to know where it was.
2) Tracking mouseMoved events until the menu pops up – unfortunately you get no way to figure out when the menu opens, so the best you can get is the position of the mouse when your action was sent (which is possibly a long way off the original click).
3) Searching the docs for some kind of position/location/frame/etc property on NSMenu and friends – no luck.

Is there a correct way to do this?

Thanks

Tom Davie_______________________________________________

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

  • Follow-Ups:
    • Re: Locating a contextual menu
      • From: Andy Lee <email@hidden>
  • Prev by Date: CGImageForProposedRect not scaling image
  • Next by Date: Re: Locating a contextual menu
  • Previous by thread: Re: CGImageForProposedRect not scaling image
  • Next by thread: Re: Locating a contextual menu
  • Index(es):
    • Date
    • Thread