// suspend/resume redrawing the control
void Freeze();
void Thaw();
+
+ void SetFocus();
void OnRenameTimer();
void OnRenameAccept();
m_owner->OnRenameAccept();
m_finished = TRUE;
- m_owner->SetFocus(); // This doesn't work. TODO.
+ m_owner->SetFocus();
return;
}
wxPendingDelete.Append(this);
m_finished = TRUE;
- m_owner->SetFocus(); // This doesn't work. TODO.
+ m_owner->SetFocus();
return;
}
wxPoint myPos = GetPosition();
wxSize mySize = GetSize();
int sx, sy;
- GetTextExtent(GetValue() + _T("M"), &sx, &sy); // FIXME: MM??
+ GetTextExtent(GetValue() + _T("MM"), &sx, &sy);
if (myPos.x + sx > parentSize.x)
sx = parentSize.x - myPos.x;
if (mySize.x > sx)
extern wxWindow *g_focusWindow;
#endif
+void wxListMainWindow::SetFocus()
+{
+ // VS: wxListMainWindow derives from wxPanel (via wxScrolledWindow) and wxPanel
+ // overrides SetFocus in such way that it does never change focus from
+ // panel's child to the panel itself. Unfortunately, we must be able to change
+ // focus to the panel from wxListTextCtrl because the text control should
+ // disappear when the user clicks outside it.
+
+ wxWindow *oldFocus = FindFocus();
+
+ if ( oldFocus && oldFocus->GetParent() == this )
+ {
+ wxWindow::SetFocus();
+ }
+ else
+ {
+ wxScrolledWindow::SetFocus();
+ }
+}
+
void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
{
// wxGTK sends us EVT_SET_FOCUS events even if we had never got
style = style | wxLC_LIST;
}
- if ( !wxControl::Create( parent, id, pos, size, style, validator, "listctrl" ) )
+ if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return FALSE;
// don't create the inner window with the border