Don't use wxToolBarToolBase::SetNormalBitmap() in wxToolbook.
This doesn't work, use wxToolBar::SetToolNormalBitmap() which does. As a side effect, don't silently ignore invalid page indices in wxToolbook::SetPageImage() any more, they should result in an assert, which is now going to happen inside wxToolBar::SetToolNormalBitmap() if this method is called with an invalid index. See #16985.
This commit is contained in:
@@ -167,16 +167,9 @@ bool wxToolbook::SetPageImage(size_t n, int imageId)
|
|||||||
if (!GetImageList())
|
if (!GetImageList())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxToolBarToolBase* tool = GetToolBar()->FindById(n + 1);
|
GetToolBar()->SetToolNormalBitmap(n + 1, GetImageList()->GetBitmap(imageId));
|
||||||
if (tool)
|
|
||||||
{
|
return true;
|
||||||
// Find the image list index for this tool
|
|
||||||
wxBitmap bitmap = GetImageList()->GetBitmap(imageId);
|
|
||||||
tool->SetNormalBitmap(bitmap);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user