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:
Vadim Zeitlin
2010-06-20 17:42:56 +00:00
parent 0033b1dfba
commit f074df3446

View File

@@ -1076,10 +1076,14 @@ void wxWindowMSW::SetScrollbar(int orient,
info.nMax = range - 1; // as both nMax and nMax are inclusive
info.nPos = pos;
// enable the scrollbar if it had been disabled before by specifying
// SIF_DISABLENOSCROLL below: as we can't know whether this had been
// done or not just do it always
::EnableScrollBar(hwnd, WXOrientToSB(orient), ESB_ENABLE_BOTH);
// We normally also reenable scrollbar in case it had been previously
// disabled by specifying SIF_DISABLENOSCROLL below but we should only
// 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);
}
}
//else: leave all the fields to be 0