Fix erroneous header click event after double click

See #18490
This commit is contained in:
Paul Cornett 2019-09-04 11:41:28 -07:00
parent 2c27f9851b
commit 92cbb02e9f
2 changed files with 7 additions and 1 deletions

View File

@ -176,6 +176,7 @@ private:
// (its size is always m_numColumns)
wxArrayInt m_colIndices;
bool m_wasSeparatorDClick;
wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl);

View File

@ -58,6 +58,7 @@ void wxHeaderCtrl::Init()
m_colBeingReordered = COL_NONE;
m_dragOffset = 0;
m_scrollOffset = 0;
m_wasSeparatorDClick = false;
}
bool wxHeaderCtrl::Create(wxWindow *parent,
@ -611,6 +612,9 @@ void wxHeaderCtrl::OnKeyDown(wxKeyEvent& event)
void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
{
const bool wasSeparatorDClick = m_wasSeparatorDClick;
m_wasSeparatorDClick = false;
// do this in advance to allow simply returning if we're not interested,
// we'll undo it if we do handle the event below
mevent.Skip();
@ -713,8 +717,9 @@ void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
if ( onSeparator && dblclk )
{
evtType = wxEVT_HEADER_SEPARATOR_DCLICK;
m_wasSeparatorDClick = true;
}
else // not double click on separator
else if (!wasSeparatorDClick)
{
evtType = click ? wxEVT_HEADER_CLICK
: wxEVT_HEADER_DCLICK;