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.
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