fixed infinite recursion in SetFocus()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-08-06 12:12:32 +00:00
parent 003d347f8d
commit 24a7a1980f
2 changed files with 7 additions and 8 deletions

View File

@@ -52,8 +52,9 @@ public:
void HandleOnFocus(wxFocusEvent& event); void HandleOnFocus(wxFocusEvent& event);
void HandleOnWindowDestroy(wxWindowBase *child); void HandleOnWindowDestroy(wxWindowBase *child);
// should be called from SetFocus() // should be called from SetFocus(), returns FALSE if we did nothing with
void DoSetFocus(); // the focus and the default processing should take place
bool DoSetFocus();
protected: protected:
// set the focus to the child which had it the last time // set the focus to the child which had it the last time
@@ -119,7 +120,8 @@ void classname::RemoveChild(wxWindowBase *child) \
\ \
void classname::SetFocus() \ void classname::SetFocus() \
{ \ { \
container->DoSetFocus(); \ if ( !container->DoSetFocus() ) \
wxWindow::SetFocus(); \
} \ } \
\ \
void classname::OnChildFocus(wxChildFocusEvent& event) \ void classname::OnChildFocus(wxChildFocusEvent& event) \

View File

@@ -241,7 +241,7 @@ void wxControlContainer::HandleOnWindowDestroy(wxWindowBase *child)
// focus handling // focus handling
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxControlContainer::DoSetFocus() bool wxControlContainer::DoSetFocus()
{ {
wxLogTrace(_T("focus"), _T("SetFocus on wxPanel 0x%08x."), wxLogTrace(_T("focus"), _T("SetFocus on wxPanel 0x%08x."),
m_winParent->GetHandle()); m_winParent->GetHandle());
@@ -273,10 +273,7 @@ void wxControlContainer::DoSetFocus()
// //
// RR: Removed for now. Let's see what happens.. // RR: Removed for now. Let's see what happens..
if ( !SetFocusToChild() ) return SetFocusToChild();
{
m_winParent->SetFocus();
}
} }
void wxControlContainer::HandleOnFocus(wxFocusEvent& event) void wxControlContainer::HandleOnFocus(wxFocusEvent& event)