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:
parent
ca9e521481
commit
52a368fed1
@ -2238,6 +2238,8 @@ protected:
|
||||
unsigned int selFlags = wxPG_SEL_NOVALIDATE,
|
||||
unsigned int column = 1 );
|
||||
|
||||
// This function only moves focus to the wxPropertyGrid if it already
|
||||
// was on one of its child controls.
|
||||
void SetFocusOnCanvas();
|
||||
|
||||
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
|
||||
// GTK+, which, unlike Windows, clears focus when control is destroyed
|
||||
// instead of moving it to closest parent).
|
||||
wxWindow* focus = wxWindow::FindFocus();
|
||||
if ( focus )
|
||||
{
|
||||
wxWindow* parent = focus->GetParent();
|
||||
while ( parent )
|
||||
{
|
||||
if ( parent == this )
|
||||
{
|
||||
SetFocusOnCanvas();
|
||||
break;
|
||||
}
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
}
|
||||
SetFocusOnCanvas();
|
||||
|
||||
// Do not free editors immediately if processing events
|
||||
if ( m_wndEditor2 )
|
||||
@ -4691,7 +4678,24 @@ void wxPropertyGrid::SetVirtualWidth( int width )
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user