lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] switch census view to use wxDataViewCtrl


From: Vaclav Slavik
Subject: Re: [lmi] switch census view to use wxDataViewCtrl
Date: Wed, 10 Aug 2011 13:11:27 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

On 2011-08-03 21:07, Greg Chicares wrote:
>> And it does make sense to select the first row that will now occupy the place
>> > of deleted rows.
> If you have rows representing all uppercase ASCII letters, and you delete B 
> and F,
> then the selection could be set to A or C, or E or G; I don't think it matters
> which of those we choose. (Of course, if A and Z are deleted, we'd have to 
> pick
> either B or Y.)

The following patch sets the new selection to C. As you said, it doesn't matter
much and this one was the simplest to implement.


---
 census_view.cpp |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/census_view.cpp b/census_view.cpp
index d66c98f..dd80c87 100644
--- a/census_view.cpp
+++ b/census_view.cpp
@@ -944,6 +944,9 @@ void CensusView::UponDeleteCells(wxCommandEvent&)
     for(unsigned int j = erasures.front(); j < cell_parms().size(); ++j)
         list_model_->RowValueChanged(j, CensusViewDataViewModel::Col_CellNum);
 
+    const unsigned int newsel = std::min(static_cast<unsigned 
int>(erasures.front()), cell_parms().size() - 1);
+    list_window_->Select(list_model_->GetItem(newsel));
+
     Update();
     document().Modify(true);
 }
-- 
1.7.6


(To be applied on top of my "Fix model notifications in 
CensusView::UponDeleteCells()",
but you can also add the two new lines manually near the end of 
UponDeleteCells(),
before Update().)

Regards,
Vaclav






reply via email to

[Prev in Thread] Current Thread [Next in Thread]