#endif
-wxPanel::wxPanel()
+void wxPanel::Init()
{
- m_lastFocus = 0;
+ m_winLastFocused = (wxWindow *)NULL;
+ m_btnDefault = (wxButton *)NULL;
}
bool wxPanel::Create(wxWindow *parent, wxWindowID id,
long style,
const wxString& name)
{
- m_lastFocus = 0;
-
bool ret = wxWindow::Create(parent, id, pos, size, style, name);
if ( ret )
void wxPanel::OnFocus(wxFocusEvent& event)
{
- if (m_lastFocus != 0)
+ if ( m_winLastFocused )
{
- wxWindow* child = FindWindow(m_lastFocus);
- if (child)
- child->SetFocus();
+ // it might happen that the window got reparented...
+ if ( m_winLastFocused->GetParent() != this )
+ m_winLastFocused = (wxWindow *)NULL;
+ else
+ m_winLastFocused->SetFocus();
}
else
event.Skip();