Properly notify active editor control when it receives the focus.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-12-19 12:08:00 +00:00
parent 42427d8950
commit bc0f253462

View File

@@ -5565,6 +5565,8 @@ bool wxPropertyGrid::IsEditorFocused() const
void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused ) void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused )
{ {
unsigned int oldFlags = m_iFlags; unsigned int oldFlags = m_iFlags;
bool wasEditorFocused = false;
wxWindow* wndEditor = m_wndEditor;
m_iFlags &= ~(wxPG_FL_FOCUSED); m_iFlags &= ~(wxPG_FL_FOCUSED);
@@ -5573,9 +5575,13 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused )
// This must be one of nextFocus' parents. // This must be one of nextFocus' parents.
while ( parent ) while ( parent )
{ {
if ( parent == wndEditor )
{
wasEditorFocused = true;
}
// Use m_eventObject, which is either wxPropertyGrid or // Use m_eventObject, which is either wxPropertyGrid or
// wxPropertyGridManager, as appropriate. // wxPropertyGridManager, as appropriate.
if ( parent == m_eventObject ) else if ( parent == m_eventObject )
{ {
m_iFlags |= wxPG_FL_FOCUSED; m_iFlags |= wxPG_FL_FOCUSED;
break; break;
@@ -5583,6 +5589,17 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused )
parent = parent->GetParent(); parent = parent->GetParent();
} }
// Notify editor control when it receives a focus
if ( wasEditorFocused && m_curFocused != newFocused )
{
wxPGProperty* p = GetSelection();
if ( p )
{
const wxPGEditor* editor = p->GetEditorClass();
editor->OnFocus(p, GetEditorControl());
}
}
m_curFocused = newFocused; m_curFocused = newFocused;
if ( (m_iFlags & wxPG_FL_FOCUSED) != if ( (m_iFlags & wxPG_FL_FOCUSED) !=