]> git.saurik.com Git - wxWidgets.git/commitdiff
GetString() method queries the control for the string when called, m_commandString...
authorKevin Hock <hockkn@yahoo.com>
Tue, 18 Jan 2005 15:15:49 +0000 (15:15 +0000)
committerKevin Hock <hockkn@yahoo.com>
Tue, 18 Jan 2005 15:15:49 +0000 (15:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/event.cpp

index 55484498bb2926adc534c3a046e795e75e228ead..d126c48550ab7048d7f721908177a3e615e5ee76 100644 (file)
@@ -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