NSMenu canelTracking is not working on Mac OSx 10.5

193 Views Asked by At

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.

1

There are 1 best solutions below

0
Akhil Shrivastav On BEST ANSWER

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