[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [6446] Select first added cell after pasting, to restore k
From: |
Greg Chicares |
Subject: |
[lmi-commits] [6446] Select first added cell after pasting, to restore keyboard focus |
Date: |
Mon, 14 Dec 2015 23:49:23 +0000 |
Revision: 6446
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6446
Author: chicares
Date: 2015-12-14 23:49:22 +0000 (Mon, 14 Dec 2015)
Log Message:
-----------
Select first added cell after pasting, to restore keyboard focus
Modified Paths:
--------------
lmi/trunk/census_view.cpp
Modified: lmi/trunk/census_view.cpp
===================================================================
--- lmi/trunk/census_view.cpp 2015-12-14 19:03:50 UTC (rev 6445)
+++ lmi/trunk/census_view.cpp 2015-12-14 23:49:22 UTC (rev 6446)
@@ -1506,12 +1506,12 @@
<< n_items
<< " cells?"
;
- int z = wxMessageBox
+ int yes_or_no = wxMessageBox
(oss.str()
,"Confirm deletion"
,wxYES_NO | wxICON_QUESTION
);
- if(wxYES != z)
+ if(wxYES != yes_or_no)
{
return;
}
@@ -1554,9 +1554,9 @@
(static_cast<std::size_t>(erasures.front())
,cell_parms().size() - 1
);
- wxDataViewItem const& y = list_model_->GetItem(newsel);
- list_window_->Select(y);
- list_window_->EnsureVisible(y);
+ wxDataViewItem const& z = list_model_->GetItem(newsel);
+ list_window_->Select(z);
+ list_window_->EnsureVisible(z);
Update();
document().Modify(true);
@@ -1788,11 +1788,20 @@
cell_parms ().clear();
}
+ unsigned int selection = cell_parms().size();
std::back_insert_iterator<std::vector<Input> > iip(cell_parms());
std::copy(cells.begin(), cells.end(), iip);
document().Modify(true);
list_model_->Reset(cell_parms().size());
Update();
+ // Reset() leaves the listview unreachable from the keyboard
+ // because no row is selected--so select the first added row
+ // if possible, else the row after which no row was inserted.
+ selection = std::min(selection, cell_parms().size());
+ wxDataViewItem const& z = list_model_->GetItem(selection);
+ list_window_->Select(z);
+ list_window_->EnsureVisible(z);
+
status() << std::flush;
LMI_ASSERT(1 == case_parms().size());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [6446] Select first added cell after pasting, to restore keyboard focus,
Greg Chicares <=