X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f1ae4143271ae63a17e052a1a471d16e9cd8c44..594f0f5bf1355fb8d58f403d3ebacc1c1767c429:/src/mac/carbon/combobox.cpp diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 1689c15490..36e92ad7a3 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -14,6 +14,7 @@ #endif #include "wx/combobox.h" +#include "wx/menu.h" #include "wx/mac/uma.h" #if !USE_SHARED_LIBRARY @@ -39,7 +40,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ; - m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , -12345 , 0, + m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , -12345 , 0, kControlPopupButtonProc , (long) this ) ; m_macPopUpMenuHandle = NewMenu( 1 , "\pPopUp Menu" ) ; @@ -176,10 +177,16 @@ int wxComboBox::FindString(const wxString& s) const wxString wxComboBox::GetString(int n) const { - Str255 text ; - ::GetMenuItemText( m_macPopUpMenuHandle , n+1 , text ) ; - p2cstr( text ) ; - return wxString( text ); + Str255 p_text ; + char c_text[255]; + ::GetMenuItemText( m_macPopUpMenuHandle , n+1 , p_text ) ; +#if TARGET_CARBON + p2cstrcpy( c_text, p_text ) ; +#else + p2cstr( p_text ) ; + strcpy( c_text, (char *) p_text ) ; +#endif + return wxString( c_text ); } wxString wxComboBox::GetStringSelection() const @@ -208,8 +215,7 @@ void wxComboBox::MacHandleControlClick( ControlHandle control , SInt16 controlpa wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId ); event.SetInt(GetSelection()); event.SetEventObject(this); - event.SetString(copystring(GetStringSelection())); + event.SetString(GetStringSelection()); ProcessCommand(event); - delete[] event.GetString(); }