#include "wx/control.h"
#include "wx/utils.h"
#include "wx/dc.h"
+ #include "wx/textctrl.h"
#endif // wxUSE_GUI
#endif
*
*/
+#ifdef __VISUALC__
+ // 'this' : used in base member initializer list (for m_commandString)
+ #pragma warning(disable:4355)
+#endif
+
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;
m_propagationLevel = wxEVENT_PROPAGATE_MAX;
}
+#ifdef __VISUALC__
+ #pragma warning(default:4355)
+#endif
+
+wxString wxCommandEvent::GetString() const
+{
+ if(m_eventType != wxEVT_COMMAND_TEXT_UPDATED || !m_eventObject)
+ return m_cmdString;
+ else
+ {
+#if wxUSE_TEXTCTRL
+ wxTextCtrl *txt = wxDynamicCast(m_eventObject, wxTextCtrl);
+ if(txt)
+ return txt->GetValue();
+ else
+#endif // wxUSE_TEXTCTRL
+ return m_cmdString;
+ }
+}
+
/*
* UI update events
*/
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
+ // remember last event to process during this iteration
+ wxList::compatibility_iterator lastPendingNode = m_pendingEvents->GetLast();
+
wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
while ( node )
{
wxENTER_CRIT_SECT( *m_eventsLocker);
#endif
+ // leave the loop once we have processed all events that were present
+ // at the start of ProcessPendingEvents because otherwise we could get
+ // into infinite loop if the pending event handler execution resulted
+ // in another event being posted
+ if ( node == lastPendingNode )
+ break;
+
node = m_pendingEvents->GetFirst();
}
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