+ DisassociateNSMenu([(NSPopUpButton*)m_cocoaNSView menu]);
+
+ if(m_sortedStrings)
+ m_sortedStrings->Clear();
+ delete m_sortedStrings;
+
+ if(HasClientObjectData())
+ {
+ for(size_t i=0; i < m_itemsClientData.GetCount(); i++)
+ delete (wxClientData*)m_itemsClientData.Item(i);
+ }
+ m_itemsClientData.Clear();
+}
+
+void wxChoice::CocoaNotification_menuDidSendAction(WX_NSNotification notification)
+{
+ NSDictionary *userInfo = [notification userInfo];
+ NSMenuItem *menuitem = [userInfo objectForKey:@"MenuItem"];
+ int index = [[(NSPopUpButton*)m_cocoaNSView menu] indexOfItem: menuitem];
+ int selectedItem = [(NSPopUpButton*)m_cocoaNSView indexOfSelectedItem];
+ wxLogTrace(wxTRACE_COCOA,wxT("menuDidSendAction, index=%d, selectedItem=%d"), index, selectedItem);
+ wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
+ event.SetInt(index);
+ event.SetEventObject(this);
+ event.SetString(GetStringSelection());
+ GetEventHandler()->ProcessEvent(event);