X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f9e02ac76b28a6787e7714a5c1f6ade2d46cd7a0..184b5d99a5382cd7a19888c85aff11f8a21af2f6:/src/motif/choice.cpp?ds=sidebyside diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index e21631b19a..566dc1ea49 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -50,7 +50,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, { SetName(name); SetValidator(validator); - m_noStrings = n; + m_noStrings = 0; // Starts off with none, incremented in Append m_windowStyle = style; m_buttonWidget = (WXWidget) 0; m_menuWidget = (WXWidget) 0; @@ -66,6 +66,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, m_backgroundColour = parent->GetBackgroundColour(); m_foregroundColour = parent->GetForegroundColour(); + m_windowFont = parent->GetFont(); Widget parentWidget = (Widget) parent->GetClientWidget(); @@ -125,7 +126,6 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL); - m_windowFont = parent->GetFont(); ChangeFont(FALSE); AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y); @@ -145,14 +145,17 @@ wxChoice::~wxChoice() if (m_widgetList) delete[] m_widgetList; - DetachWidget(GetMainWidget()); // Removes event handlers + if (GetMainWidget()) + { + DetachWidget(GetMainWidget()); // Removes event handlers - XtDestroyWidget((Widget) m_formWidget); - m_formWidget = (WXWidget) 0; + XtDestroyWidget((Widget) m_formWidget); + m_formWidget = (WXWidget) 0; - // Presumably the other widgets have been deleted now, via the form - m_mainWidget = (WXWidget) 0; - m_buttonWidget = (WXWidget) 0; + // Presumably the other widgets have been deleted now, via the form + m_mainWidget = (WXWidget) 0; + m_buttonWidget = (WXWidget) 0; + } } void wxChoice::Append(const wxString& item) @@ -416,7 +419,8 @@ void wxChoiceCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr)) XtVaGetValues (w, XmNuserData, &s, NULL); if (s) { - wxCommandEvent event (wxEVT_COMMAND_CHOICE_SELECTED); + wxCommandEvent event (wxEVT_COMMAND_CHOICE_SELECTED, item->GetId()); + event.SetEventObject(item); event.m_commandInt = item->FindString (s); // event.m_commandString = s; item->ProcessCommand (event);