Ignore focus events within composite editor control in wxDataViewRenderer
Internal focused state and focused events of the subcontrols of the composite editor control should not be taken into account. Closes #18394.
This commit is contained in:
@@ -62,6 +62,8 @@ protected:
|
|||||||
void OnIdle( wxIdleEvent &event );
|
void OnIdle( wxIdleEvent &event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool IsEditorSubControl(wxWindow* win) const;
|
||||||
|
|
||||||
wxDataViewRenderer *m_owner;
|
wxDataViewRenderer *m_owner;
|
||||||
wxWindow *m_editorCtrl;
|
wxWindow *m_editorCtrl;
|
||||||
bool m_finished;
|
bool m_finished;
|
||||||
@@ -1113,8 +1115,13 @@ void wxDataViewEditorCtrlEvtHandler::OnIdle( wxIdleEvent &event )
|
|||||||
if (m_focusOnIdle)
|
if (m_focusOnIdle)
|
||||||
{
|
{
|
||||||
m_focusOnIdle = false;
|
m_focusOnIdle = false;
|
||||||
if (wxWindow::FindFocus() != m_editorCtrl)
|
|
||||||
|
// Ignore focused items within the compound editor control
|
||||||
|
wxWindow* win = wxWindow::FindFocus();
|
||||||
|
if ( !IsEditorSubControl(win) )
|
||||||
|
{
|
||||||
m_editorCtrl->SetFocus();
|
m_editorCtrl->SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@@ -1151,6 +1158,14 @@ void wxDataViewEditorCtrlEvtHandler::OnChar( wxKeyEvent &event )
|
|||||||
|
|
||||||
void wxDataViewEditorCtrlEvtHandler::OnKillFocus( wxFocusEvent &event )
|
void wxDataViewEditorCtrlEvtHandler::OnKillFocus( wxFocusEvent &event )
|
||||||
{
|
{
|
||||||
|
// Ignore focus changes within the compound editor control
|
||||||
|
wxWindow* win = event.GetWindow();
|
||||||
|
if ( IsEditorSubControl(win) )
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_finished)
|
if (!m_finished)
|
||||||
{
|
{
|
||||||
m_finished = true;
|
m_finished = true;
|
||||||
@@ -1160,6 +1175,23 @@ void wxDataViewEditorCtrlEvtHandler::OnKillFocus( wxFocusEvent &event )
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxDataViewEditorCtrlEvtHandler::IsEditorSubControl(wxWindow* win) const
|
||||||
|
{
|
||||||
|
// Checks whether the given window belongs to the editor control
|
||||||
|
// (is either the editor itself or a child of the compound editor).
|
||||||
|
while ( win )
|
||||||
|
{
|
||||||
|
if ( win == m_editorCtrl )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
win = win->GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
// wxDataViewColumnBase
|
// wxDataViewColumnBase
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user