Dylan Smith : richedit: Suppress scrollbar if missing WS_[VH]SCROLL style.

Alexandre Julliard julliard at winehq.org
Wed Jan 28 08:03:08 CST 2009


Module: wine
Branch: master
Commit: a051a231190a0b76887a8f90a00d41b54ac703d5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a051a231190a0b76887a8f90a00d41b54ac703d5

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Wed Jan 28 01:35:02 2009 -0500

richedit: Suppress scrollbar if missing WS_[VH]SCROLL style.

If the scrollbar style isn't initially used, then the scrollbar should
be shown.  Otherwise this can be a problem when the horizontal scrollbar
is shown for a single line richedit control, since it will cover all the
text (See bug 12088).

---

 dlls/riched20/paint.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 7d7ea76..0c027e4 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1067,14 +1067,16 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
   {
     LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
     bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0;
-    bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx)
+    bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx
+                               && (editor->styleFlags & WS_HSCROLL))
                               || (editor->styleFlags & ES_DISABLENOSCROLL);
     if (bScrollBarIsVisible != bScrollBarWillBeVisible)
       ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
                                 bScrollBarWillBeVisible);
 
     bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0;
-    bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy)
+    bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy
+                               && (editor->styleFlags & WS_VSCROLL))
                               || (editor->styleFlags & ES_DISABLENOSCROLL);
     if (bScrollBarIsVisible != bScrollBarWillBeVisible)
       ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
@@ -1163,8 +1165,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
     }
   }
 
-  if (si.fMask & SIF_DISABLENOSCROLL)
+  if (si.fMask & SIF_DISABLENOSCROLL) {
     bScrollBarWillBeVisible = TRUE;
+  } else if (!(editor->styleFlags & WS_HSCROLL)) {
+    /* SetScrollInfo or SetScrollRange may cause the scrollbar to be
+     * shown, so hide the scrollbar if necessary. */
+    bScrollBarWasVisible = bScrollBarWillBeVisible;
+    bScrollBarWillBeVisible = FALSE;
+  }
 
   if (bScrollBarWasVisible != bScrollBarWillBeVisible)
     ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible);
@@ -1203,8 +1211,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
     }
   }
 
-  if (si.fMask & SIF_DISABLENOSCROLL)
+  if (si.fMask & SIF_DISABLENOSCROLL) {
     bScrollBarWillBeVisible = TRUE;
+  } else if (!(editor->styleFlags & WS_VSCROLL)) {
+    /* SetScrollInfo or SetScrollRange may cause the scrollbar to be
+     * shown, so hide the scrollbar if necessary. */
+    bScrollBarWasVisible = bScrollBarWillBeVisible;
+    bScrollBarWillBeVisible = FALSE;
+  }
 
   if (bScrollBarWasVisible != bScrollBarWillBeVisible)
     ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,




More information about the wine-cvs mailing list