Make generic wxDataViewCtrl initially usable from keyboard.

This control doesn't react to the keyboard at all if it doesn't have a current
row and as it doesn't have it initially, it means that there is no way to do
anything with the control without clicking it with the mouse first.

Fix this by giving it a current row, if possible, whenever it gains focus.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2015-01-09 03:30:02 +00:00
parent 5c9d7e139d
commit 6fad9cf2d9

View File

@ -4464,6 +4464,13 @@ void wxDataViewMainWindow::OnSetFocus( wxFocusEvent &event )
{
m_hasFocus = true;
// Make the control usable from keyboard once it gets focus by ensuring
// that it has a current row, if at all possible.
if ( !HasCurrentRow() && !IsEmpty() )
{
ChangeCurrentRow(0);
}
if (HasCurrentRow())
Refresh();