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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to