To prevent wxPropertyGrid from stealing frocus from other controls, only let SetFocusOnCanvas() move focus to the main grid 'canvas' if focus was already in on the grid's child controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2238,6 +2238,8 @@ protected:
|
|||||||
unsigned int selFlags = wxPG_SEL_NOVALIDATE,
|
unsigned int selFlags = wxPG_SEL_NOVALIDATE,
|
||||||
unsigned int column = 1 );
|
unsigned int column = 1 );
|
||||||
|
|
||||||
|
// This function only moves focus to the wxPropertyGrid if it already
|
||||||
|
// was on one of its child controls.
|
||||||
void SetFocusOnCanvas();
|
void SetFocusOnCanvas();
|
||||||
|
|
||||||
bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
|
bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
|
||||||
|
@@ -3982,20 +3982,7 @@ void wxPropertyGrid::FreeEditors()
|
|||||||
// Return focus back to canvas from children (this is required at least for
|
// Return focus back to canvas from children (this is required at least for
|
||||||
// GTK+, which, unlike Windows, clears focus when control is destroyed
|
// GTK+, which, unlike Windows, clears focus when control is destroyed
|
||||||
// instead of moving it to closest parent).
|
// instead of moving it to closest parent).
|
||||||
wxWindow* focus = wxWindow::FindFocus();
|
SetFocusOnCanvas();
|
||||||
if ( focus )
|
|
||||||
{
|
|
||||||
wxWindow* parent = focus->GetParent();
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if ( parent == this )
|
|
||||||
{
|
|
||||||
SetFocusOnCanvas();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
parent = parent->GetParent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not free editors immediately if processing events
|
// Do not free editors immediately if processing events
|
||||||
if ( m_wndEditor2 )
|
if ( m_wndEditor2 )
|
||||||
@@ -4691,7 +4678,24 @@ void wxPropertyGrid::SetVirtualWidth( int width )
|
|||||||
|
|
||||||
void wxPropertyGrid::SetFocusOnCanvas()
|
void wxPropertyGrid::SetFocusOnCanvas()
|
||||||
{
|
{
|
||||||
SetFocus();
|
// To prevent wxPropertyGrid from stealing focus from other controls,
|
||||||
|
// only move focus to the grid if it was already in one if its child
|
||||||
|
// controls.
|
||||||
|
wxWindow* focus = wxWindow::FindFocus();
|
||||||
|
if ( focus )
|
||||||
|
{
|
||||||
|
wxWindow* parent = focus->GetParent();
|
||||||
|
while ( parent )
|
||||||
|
{
|
||||||
|
if ( parent == this )
|
||||||
|
{
|
||||||
|
SetFocus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parent = parent->GetParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_editorFocused = 0;
|
m_editorFocused = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user