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
This commit is contained in:
Kevin Hock 2005-01-18 15:15:49 +00:00
parent 4bde3754eb
commit ab1931f98e

View 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