Have wxPropertyGridEditorEventForwarder::ProcessEvent() return true more often - that is when the event was recognized as being 'handled', and specifically for the case of property editor's button being pressed (fixes #12487).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1526,7 +1526,7 @@ public:
|
|||||||
void RefreshEditor();
|
void RefreshEditor();
|
||||||
|
|
||||||
// Events from editor controls are forward to this function
|
// Events from editor controls are forward to this function
|
||||||
void HandleCustomEditorEvent( wxEvent &event );
|
bool HandleCustomEditorEvent( wxEvent &event );
|
||||||
|
|
||||||
// Mostly useful for page switching.
|
// Mostly useful for page switching.
|
||||||
void SwitchState( wxPropertyGridPageState* pNewState );
|
void SwitchState( wxPropertyGridPageState* pNewState );
|
||||||
|
@@ -3542,13 +3542,19 @@ bool wxPropertyGrid::DoEditorValidate()
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
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
|
// It is possible that this handler receives event even before
|
||||||
// the control has been properly initialized. Let's skip the
|
// the control has been properly initialized. Let's skip the
|
||||||
// event handling in that case.
|
// event handling in that case.
|
||||||
if ( !m_pState )
|
if ( !m_pState )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
// Don't care about the event if it originated from the
|
// Don't care about the event if it originated from the
|
||||||
// 'label editor'. In this function we only care about the
|
// 'label editor'. In this function we only care about the
|
||||||
@@ -3556,7 +3562,7 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
if ( m_labelEditor && event.GetId() == m_labelEditor->GetId() )
|
if ( m_labelEditor && event.GetId() == m_labelEditor->GetId() )
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPGProperty* selected = GetSelection();
|
wxPGProperty* selected = GetSelection();
|
||||||
@@ -3570,10 +3576,10 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
// similar is currently doing something (showing a
|
// similar is currently doing something (showing a
|
||||||
// message box, for instance).
|
// message box, for instance).
|
||||||
m_processedEvent )
|
m_processedEvent )
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
if ( m_iFlags & wxPG_FL_IN_HANDLECUSTOMEDITOREVENT )
|
if ( m_iFlags & wxPG_FL_IN_HANDLECUSTOMEDITOREVENT )
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
wxVariant pendingValue(selected->GetValueRef());
|
wxVariant pendingValue(selected->GetValueRef());
|
||||||
wxWindow* wnd = GetEditorControl();
|
wxWindow* wnd = GetEditorControl();
|
||||||
@@ -3597,7 +3603,7 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
|
|
||||||
wxString newTcValue = tc->GetValue();
|
wxString newTcValue = tc->GetValue();
|
||||||
if ( m_prevTcValue == newTcValue )
|
if ( m_prevTcValue == newTcValue )
|
||||||
return;
|
return true;
|
||||||
m_prevTcValue = newTcValue;
|
m_prevTcValue = newTcValue;
|
||||||
}
|
}
|
||||||
else if ( wnd->IsKindOf(CLASSINFO(wxComboCtrl)) )
|
else if ( wnd->IsKindOf(CLASSINFO(wxComboCtrl)) )
|
||||||
@@ -3606,7 +3612,7 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
|
|
||||||
wxString newTcValue = cc->GetTextCtrl()->GetValue();
|
wxString newTcValue = cc->GetTextCtrl()->GetValue();
|
||||||
if ( m_prevTcValue == newTcValue )
|
if ( m_prevTcValue == newTcValue )
|
||||||
return;
|
return true;
|
||||||
m_prevTcValue = newTcValue;
|
m_prevTcValue = newTcValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3615,6 +3621,7 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
|
|
||||||
bool validationFailure = false;
|
bool validationFailure = false;
|
||||||
bool buttonWasHandled = false;
|
bool buttonWasHandled = false;
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try common button handling
|
// Try common button handling
|
||||||
@@ -3642,6 +3649,8 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
|
|
||||||
if ( editor->OnEvent( this, selected, editorWnd, event ) )
|
if ( editor->OnEvent( this, selected, editorWnd, event ) )
|
||||||
{
|
{
|
||||||
|
result = true;
|
||||||
|
|
||||||
// If changes, validate them
|
// If changes, validate them
|
||||||
if ( DoEditorValidate() )
|
if ( DoEditorValidate() )
|
||||||
{
|
{
|
||||||
@@ -3715,12 +3724,15 @@ void wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
|
|||||||
// Let unhandled button click events go to the parent
|
// Let unhandled button click events go to the parent
|
||||||
if ( !buttonWasHandled && event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
|
if ( !buttonWasHandled && event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
|
||||||
{
|
{
|
||||||
|
result = true;
|
||||||
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED,GetId());
|
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED,GetId());
|
||||||
GetEventHandler()->AddPendingEvent(evt);
|
GetEventHandler()->AddPendingEvent(evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearInternalFlag(wxPG_FL_IN_HANDLECUSTOMEDITOREVENT);
|
ClearInternalFlag(wxPG_FL_IN_HANDLECUSTOMEDITOREVENT);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -3894,7 +3906,16 @@ private:
|
|||||||
// Always skip
|
// Always skip
|
||||||
event.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
|
||||||
|
Reference in New Issue
Block a user