• 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
how do I get tracking, selection etc working with custom views in NSMenuItems?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how do I get tracking, selection etc working with custom views in NSMenuItems?


  • Subject: how do I get tracking, selection etc working with custom views in NSMenuItems?
  • From: Rua Haszard Morris <email@hidden>
  • Date: Mon, 30 Aug 2010 16:37:00 +1200

Hi Cocoa-dev,

I'm experimenting with using NSViews in menus, and was expecting that such items could continue to use Cocoa-provided implementations of mouse tracking, selecting an item and dismissing the menu, etc.

After a lot of experimentation, doc reading and googling I've managed to hook up mouse tracking somewhat correctly - by implementing the delegate method menu:willHighlightItem:, and ensuring my views get setNeedsDisplay:YES when they get un-highlighted. This seemed to work correctly but was a lot more work than I expected.

More importantly, I want the NSView items to behave the same as other menu items - i.e. when the user selects one, by mouse or keyboard, the menu dismisses and actions are sent (and the item highlight flashes briefly). I can't work out how to get this hooked up without reinventing the wheel.

Note that my NSViews don't require mouse input - I'm just using NSView items for custom display, not the more complicated case displaying a control in the menu.

Does anyone have any good pointers regarding using NSViews in an NSMenu and falling back to system-provided code for tracking and selection?

thanks
Rua HM._______________________________________________

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: how do I get tracking, selection etc working with custom views in NSMenuItems?
      • From: Raleigh Ledet <email@hidden>
  • Prev by Date: Re: Core Data and REST
  • Next by Date: Re: how do I get tracking, selection etc working with custom views in NSMenuItems?
  • Previous by thread: sdef NSXMLParserErrorDomain error 1549 in 10.5, PowerPC
  • Next by thread: Re: how do I get tracking, selection etc working with custom views in NSMenuItems?
  • Index(es):
    • Date
    • Thread