From 37d0bdff9829952ea4b4bf7f399127caae2c4cd2 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Mon, 24 Sep 2001 17:30:42 +0000 Subject: [PATCH] Fixed wxToolbar95::FindToolForPosition git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/tbar95.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 9bbd2d4ce1..3c1a1b6532 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -196,6 +196,8 @@ void wxToolBar::Init() m_defaultWidth = DEFAULTBITMAPX; m_defaultHeight = DEFAULTBITMAPY; + + m_pInTool = 0; } bool wxToolBar::Create(wxWindow *parent, @@ -895,7 +897,9 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const pt.x = x; pt.y = y; int index = (int)::SendMessage(GetHwnd(), TB_HITTEST, 0, (LPARAM)&pt); - if ( index < 0 ) + // MBN: when the point ( x, y ) is close to the toolbar border + // TB_HITTEST returns m_nButtons ( not -1 ) + if ( index < 0 || (size_t)index >= m_nButtons ) { // it's a separator or there is no tool at all there return (wxToolBarToolBase *)NULL; -- 2.45.2