1

I m using NSComboBox inside NSMenu to show a list of items. When I choose any option in NSComboBox menu should get dismissed.

To dismiss NSMenu I m using cancelTrackingWithoutAnimation for 10.6 and above and it works fine. In case of 10.5 i am using cancelTracking but it is not dismissing NSMenu.

Akhil Shrivastav
  • 427
  • 3
  • 13
  • There are a couple sample code that uses `cancelTracking`, try run those in 10.5 and see if they work or not. If they don't work then it's a bug, if they do work then your code is probably the reason why it's not working. – TheAmateurProgrammer Jul 25 '14 at 13:23

1 Answers1

1

I fixed the issue by using carbon API CancelMenuTracking(),

CancelMenuTracking(
  MenuRef   inRootMenu,
  Boolean   inImmediate,
  UInt32    inDismissalReason)  

Used _NSGetCarbonMenu to get the menuref of NSMenu.

menuRef = _NSGetCarbonMenu(myMenu);

CancelMenuTracking(menuRef,YES,kHIMenuDismissedByCancelMenuTracking); for 10.5 and CancelMenuTracking(menuRef,YES,0); for 10.6 and above

Akhil Shrivastav
  • 427
  • 3
  • 13