Fixed wxToolbar95::FindToolForPosition

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2001-09-24 17:30:42 +00:00
parent b09bda689c
commit 37d0bdff98

View File

@@ -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;