git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66240
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void RefreshEditor();
// Events from editor controls are forward to this function
void RefreshEditor();
// Events from editor controls are forward to this function
- void HandleCustomEditorEvent( wxEvent &event );
+ bool HandleCustomEditorEvent( wxEvent &event );
// Mostly useful for page switching.
void SwitchState( wxPropertyGridPageState* pNewState );
// Mostly useful for page switching.
void SwitchState( wxPropertyGridPageState* pNewState );
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
+bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
+ //
+ // NB: We should return true if the event was recognized as
+ // a dedicated wxPropertyGrid event, and as such was
+ // either properly handled or ignored.
+ //
+
// It is possible that this handler receives event even before
// the control has been properly initialized. Let's skip the
// event handling in that case.
if ( !m_pState )
// It is possible that this handler receives event even before
// the control has been properly initialized. Let's skip the
// event handling in that case.
if ( !m_pState )
// Don't care about the event if it originated from the
// 'label editor'. In this function we only care about the
// Don't care about the event if it originated from the
// 'label editor'. In this function we only care about the
if ( m_labelEditor && event.GetId() == m_labelEditor->GetId() )
{
event.Skip();
if ( m_labelEditor && event.GetId() == m_labelEditor->GetId() )
{
event.Skip();
}
wxPGProperty* selected = GetSelection();
}
wxPGProperty* selected = GetSelection();
// similar is currently doing something (showing a
// message box, for instance).
m_processedEvent )
// similar is currently doing something (showing a
// message box, for instance).
m_processedEvent )
if ( m_iFlags & wxPG_FL_IN_HANDLECUSTOMEDITOREVENT )
if ( m_iFlags & wxPG_FL_IN_HANDLECUSTOMEDITOREVENT )
wxVariant pendingValue(selected->GetValueRef());
wxWindow* wnd = GetEditorControl();
wxVariant pendingValue(selected->GetValueRef());
wxWindow* wnd = GetEditorControl();
wxString newTcValue = tc->GetValue();
if ( m_prevTcValue == newTcValue )
wxString newTcValue = tc->GetValue();
if ( m_prevTcValue == newTcValue )
m_prevTcValue = newTcValue;
}
else if ( wnd->IsKindOf(CLASSINFO(wxComboCtrl)) )
m_prevTcValue = newTcValue;
}
else if ( wnd->IsKindOf(CLASSINFO(wxComboCtrl)) )
wxString newTcValue = cc->GetTextCtrl()->GetValue();
if ( m_prevTcValue == newTcValue )
wxString newTcValue = cc->GetTextCtrl()->GetValue();
if ( m_prevTcValue == newTcValue )
m_prevTcValue = newTcValue;
}
}
m_prevTcValue = newTcValue;
}
}
bool validationFailure = false;
bool buttonWasHandled = false;
bool validationFailure = false;
bool buttonWasHandled = false;
//
// Try common button handling
//
// Try common button handling
if ( editor->OnEvent( this, selected, editorWnd, event ) )
{
if ( editor->OnEvent( this, selected, editorWnd, event ) )
{
// If changes, validate them
if ( DoEditorValidate() )
{
// If changes, validate them
if ( DoEditorValidate() )
{
// Let unhandled button click events go to the parent
if ( !buttonWasHandled && event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
{
// Let unhandled button click events go to the parent
if ( !buttonWasHandled && event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
{
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED,GetId());
GetEventHandler()->AddPendingEvent(evt);
}
}
ClearInternalFlag(wxPG_FL_IN_HANDLECUSTOMEDITOREVENT);
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED,GetId());
GetEventHandler()->AddPendingEvent(evt);
}
}
ClearInternalFlag(wxPG_FL_IN_HANDLECUSTOMEDITOREVENT);
}
// -----------------------------------------------------------------------
}
// -----------------------------------------------------------------------
// Always skip
event.Skip();
// Always skip
event.Skip();
- m_propGrid->HandleCustomEditorEvent(event);
+ if ( m_propGrid->HandleCustomEditorEvent(event) )
+ return true;
+
+ //
+ // NB: We should return true if the event was recognized as
+ // a dedicated wxPropertyGrid event, and as such was
+ // either properly handled or ignored.
+ //
+ if ( m_propGrid->IsMainButtonEvent(event) )
+ return true;
//
// NB: On wxMSW, a wxTextCtrl with wxTE_PROCESS_ENTER
//
// NB: On wxMSW, a wxTextCtrl with wxTE_PROCESS_ENTER