[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] switch census view to use wxDataViewCtrl
From: |
Greg Chicares |
Subject: |
Re: [lmi] switch census view to use wxDataViewCtrl |
Date: |
Thu, 11 Aug 2011 12:54:17 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
On 2011-08-11 11:43Z, Greg Chicares wrote:
> On 2011-08-10 11:11Z, Vaclav Slavik wrote:
[...patch to select one cell after deletion...]
> Committed 20110811T0953Z, revision 5239.
>
> I'll soon commit some refinements to ensure that, after a deletion, the new
> selection is visible;
Committed 20110811T1222Z, revision 5240.
> and to fix this issue:
[...with empty selection, deleting (zero) cells segfaults...]
Committed 20110811T1238Z, revision 5241. But I have two questions:
(1) To ascertain whether the selection is nonempty, I did:
wxDataViewItemArray selection;
unsigned int n_sel_items = list_window_->GetSelections(selection);
e.Enable(0 < n_sel_items);
Is there a better way? It seems wasteful to populate a wxDataViewItemArray
that isn't used.
(2) Concerning this code that predates these latest changes...
void CensusView::UponUpdateSingleItemActions(wxUpdateUIEvent& e)
{
bool const is_single_sel = list_window_->GetSelection().IsOk();
e.Enable(is_single_sel);
}
...I observe that enablement occurs iff exactly one cell is selected
(which is good), but I don't understand why. The documentation seems to
say that this code would detect whether one or more cells is selected:
http://docs.wxwidgets.org/trunk/classwx_data_view_ctrl.html#71cd6bc33658d944c65062f789a82f19
| virtual wxDataViewItem wxDataViewCtrl::GetSelection() const [virtual]
| Returns first selected item or an invalid item if none is selected.
If two cells are selected, shouldn't that return the first one, which
should pass the IsOK() test?
- Re: [lmi] switch census view to use wxDataViewCtrl, Greg Chicares, 2011/08/02
- Re: [lmi] switch census view to use wxDataViewCtrl, Vadim Zeitlin, 2011/08/02
- Re: [lmi] switch census view to use wxDataViewCtrl, Greg Chicares, 2011/08/03
- Re: [lmi] switch census view to use wxDataViewCtrl, Václav Slavík, 2011/08/03
- Re: [lmi] switch census view to use wxDataViewCtrl, Greg Chicares, 2011/08/03
- Re: [lmi] switch census view to use wxDataViewCtrl, Václav Slavík, 2011/08/03
- Re: [lmi] switch census view to use wxDataViewCtrl, Vaclav Slavik, 2011/08/10
- Re: [lmi] switch census view to use wxDataViewCtrl, Václav Slavík, 2011/08/10
- Re: [lmi] switch census view to use wxDataViewCtrl, Greg Chicares, 2011/08/11
- Re: [lmi] switch census view to use wxDataViewCtrl,
Greg Chicares <=
- Re: [lmi] switch census view to use wxDataViewCtrl, Vadim Zeitlin, 2011/08/12
- Re: [lmi] switch census view to use wxDataViewCtrl, Greg Chicares, 2011/08/12
Re: [lmi] switch census view to use wxDataViewCtrl, Václav Slavík, 2011/08/02
Re: [lmi] switch census view to use wxDataViewCtrl, Václav Slavík, 2011/08/02