From be7b1104bd228e179987a0bab6a5b14be7d2cb61 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Tue, 22 Jan 2013 14:27:07 -0500 Subject: Bug 393833 - Vertical scroll bar still shows after calling setVisible(false) in Windows 7 --- .../win32/org/eclipse/swt/widgets/ScrollBar.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java index 60f692a04b..b35b3ea59f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java @@ -992,6 +992,24 @@ public void setVisible (boolean visible) { state = visible ? state & ~HIDDEN : state | HIDDEN; long /*int*/ hwnd = hwndScrollBar (); int type = scrollBarType (); + /* + * Bug in Windows 7. Windows will cause pixel corruption + * when there is only one scroll bar visible and it is + * hidden. The fix is to temporarily show the other scroll + * bar and hide both. + */ + if (!visible) { + if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { + SCROLLBARINFO psbi = new SCROLLBARINFO (); + psbi.cbSize = SCROLLBARINFO.sizeof; + int idObject = (style & SWT.VERTICAL) != 0 ? OS.OBJID_HSCROLL : OS.OBJID_VSCROLL; + OS.GetScrollBarInfo (hwnd, idObject, psbi); + if ((psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) != 0) { + OS.ShowScrollBar (hwnd, type == OS.SB_VERT ? OS.SB_HORZ : OS.SB_VERT, true); + type = OS.SB_BOTH; + } + } + } if (OS.ShowScrollBar (hwnd, type, visible)) { /* * Bug in Windows. For some reason, when the widget -- cgit