account for scroll offset correctly in the mouse event handler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -134,7 +134,7 @@ int wxHeaderCtrl::GetColStart(unsigned int idx) const
|
|||||||
{
|
{
|
||||||
wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
|
wxHeaderCtrl * const self = const_cast<wxHeaderCtrl *>(this);
|
||||||
|
|
||||||
int pos = 0;
|
int pos = m_scrollOffset;
|
||||||
for ( unsigned n = 0; n < idx; n++ )
|
for ( unsigned n = 0; n < idx; n++ )
|
||||||
{
|
{
|
||||||
const wxHeaderColumnBase& col = self->GetColumn(n);
|
const wxHeaderColumnBase& col = self->GetColumn(n);
|
||||||
@@ -287,11 +287,14 @@ void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
|
|||||||
{
|
{
|
||||||
mevent.Skip();
|
mevent.Skip();
|
||||||
|
|
||||||
|
// account for the control displacement
|
||||||
|
const int x = mevent.GetX() - m_scrollOffset;
|
||||||
|
|
||||||
// find if the event is over a column at all
|
// find if the event is over a column at all
|
||||||
bool onSeparator;
|
bool onSeparator;
|
||||||
const unsigned col = mevent.Leaving()
|
const unsigned col = mevent.Leaving()
|
||||||
? (onSeparator = false, COL_NONE)
|
? (onSeparator = false, COL_NONE)
|
||||||
: FindColumnAtPos(mevent.GetX(), onSeparator);
|
: FindColumnAtPos(x, onSeparator);
|
||||||
|
|
||||||
// update the highlighted column if it changed
|
// update the highlighted column if it changed
|
||||||
if ( col != m_hover )
|
if ( col != m_hover )
|
||||||
|
Reference in New Issue
Block a user