Don't enable scrollbar if it can't do anything in wxMSW.
Only reenable scrollbar in wxWindow::SetScrollbar() in wxMSW if its range is large enough to allow scrolling it. Closes #11373. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1076,11 +1076,15 @@ void wxWindowMSW::SetScrollbar(int orient,
|
|||||||
info.nMax = range - 1; // as both nMax and nMax are inclusive
|
info.nMax = range - 1; // as both nMax and nMax are inclusive
|
||||||
info.nPos = pos;
|
info.nPos = pos;
|
||||||
|
|
||||||
// enable the scrollbar if it had been disabled before by specifying
|
// We normally also reenable scrollbar in case it had been previously
|
||||||
// SIF_DISABLENOSCROLL below: as we can't know whether this had been
|
// disabled by specifying SIF_DISABLENOSCROLL below but we should only
|
||||||
// done or not just do it always
|
// do this if it has valid range, otherwise it would be enabled but not
|
||||||
|
// do anything.
|
||||||
|
if ( range >= pageSize )
|
||||||
|
{
|
||||||
::EnableScrollBar(hwnd, WXOrientToSB(orient), ESB_ENABLE_BOTH);
|
::EnableScrollBar(hwnd, WXOrientToSB(orient), ESB_ENABLE_BOTH);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//else: leave all the fields to be 0
|
//else: leave all the fields to be 0
|
||||||
|
|
||||||
info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
|
info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
|
||||||
|
Reference in New Issue
Block a user