From ab1931f98e0b32115cee53d8276eadc6d4284f38 Mon Sep 17 00:00:00 2001 From: Kevin Hock Date: Tue, 18 Jan 2005 15:15:49 +0000 Subject: [PATCH] GetString() method queries the control for the string when called, m_commandString is no longer set for each event and cached git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/event.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index 55484498bb..d126c48550 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -382,6 +382,9 @@ wxEvent::wxEvent(const wxEvent &src) wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) : wxEvent(theId, commandType) +#if WXWIN_COMPATIBILITY_2_4 + , m_commandString(this) +#endif { m_clientData = (char *) NULL; m_clientObject = (wxClientData *) NULL; @@ -393,6 +396,20 @@ wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) m_propagationLevel = wxEVENT_PROPAGATE_MAX; } +wxString wxCommandEvent::GetString() const +{ + if(m_eventType != wxEVT_COMMAND_TEXT_UPDATED || !m_eventObject) + return m_cmdString; + else + { + wxTextCtrl *txt = wxDynamicCast(m_eventObject, wxTextCtrl); + if(txt) + return txt->GetValue(); + else + return m_cmdString; + } +} + /* * UI update events */ @@ -1345,7 +1362,7 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES - if ((event.m_eventType == entry->m_eventType) && (entry->m_fn != 0)) + if ((event.GetEventType() == entry->m_eventType) && (entry->m_fn != 0)) { wxEvtHandler *handler = #if !WXWIN_COMPATIBILITY_EVENT_TYPES -- 2.45.2