Fix spurious label editing in generic wx{List,Tree,DataView}Ctrl.

Clicking on the control to give it focus must not start editing the label of
an item in it, this is bad UI as you need to carefully select where do you
click to avoid starting to edit the label and nobody else does it like this
(probably because of the former reason).

As a side note, it would be really great to abstract the item handling in a
class that could be reused by all these controls instead of having to update 3
slightly different versions of the same code every time.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-07 22:40:29 +00:00
parent e55e1a5fda
commit 15ec266ae3
3 changed files with 28 additions and 5 deletions

View File

@@ -4289,8 +4289,15 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
m_currentCol = col;
m_currentColSetByKeyboard = false;
// This flag is used to decide whether we should start editing the item
// label. We do it if the user clicks twice (but not double clicks,
// i.e. simulateClick is false) on the same item but not if the click
// was used for something else already, e.g. selecting the item (so it
// must have been already selected) or giving the focus to the control
// (so it must have had focus already).
m_lastOnSame = !simulateClick && ((col == oldCurrentCol) &&
(current == oldCurrentRow)) && oldWasSelected;
(current == oldCurrentRow)) && oldWasSelected &&
HasFocus();
// Call ActivateCell() after everything else as under GTK+
if ( IsCellEditableInMode(item, col, wxDATAVIEW_CELL_ACTIVATABLE) )