fix for focus handling in generic wxListCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -626,6 +626,8 @@ public:
|
|||||||
// suspend/resume redrawing the control
|
// suspend/resume redrawing the control
|
||||||
void Freeze();
|
void Freeze();
|
||||||
void Thaw();
|
void Thaw();
|
||||||
|
|
||||||
|
void SetFocus();
|
||||||
|
|
||||||
void OnRenameTimer();
|
void OnRenameTimer();
|
||||||
void OnRenameAccept();
|
void OnRenameAccept();
|
||||||
@@ -2158,7 +2160,7 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event )
|
|||||||
m_owner->OnRenameAccept();
|
m_owner->OnRenameAccept();
|
||||||
|
|
||||||
m_finished = TRUE;
|
m_finished = TRUE;
|
||||||
m_owner->SetFocus(); // This doesn't work. TODO.
|
m_owner->SetFocus();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2171,7 +2173,7 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event )
|
|||||||
wxPendingDelete.Append(this);
|
wxPendingDelete.Append(this);
|
||||||
|
|
||||||
m_finished = TRUE;
|
m_finished = TRUE;
|
||||||
m_owner->SetFocus(); // This doesn't work. TODO.
|
m_owner->SetFocus();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2192,7 +2194,7 @@ void wxListTextCtrl::OnKeyUp( wxKeyEvent &event )
|
|||||||
wxPoint myPos = GetPosition();
|
wxPoint myPos = GetPosition();
|
||||||
wxSize mySize = GetSize();
|
wxSize mySize = GetSize();
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
GetTextExtent(GetValue() + _T("M"), &sx, &sy); // FIXME: MM??
|
GetTextExtent(GetValue() + _T("MM"), &sx, &sy);
|
||||||
if (myPos.x + sx > parentSize.x)
|
if (myPos.x + sx > parentSize.x)
|
||||||
sx = parentSize.x - myPos.x;
|
sx = parentSize.x - myPos.x;
|
||||||
if (mySize.x > sx)
|
if (mySize.x > sx)
|
||||||
@@ -3428,6 +3430,26 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
|||||||
extern wxWindow *g_focusWindow;
|
extern wxWindow *g_focusWindow;
|
||||||
#endif
|
#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->GetParent() == this )
|
||||||
|
{
|
||||||
|
wxWindow::SetFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxScrolledWindow::SetFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
|
void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
// wxGTK sends us EVT_SET_FOCUS events even if we had never got
|
// wxGTK sends us EVT_SET_FOCUS events even if we had never got
|
||||||
|
Reference in New Issue
Block a user