From eddccdd1f2f5bff7bd5105e64ce4795653fc9786 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Thu, 16 Jul 2009 18:45:59 -0400 Subject: [PATCH] richedit: Initially disable scrollbars for ES_DISABLENOSCROLL. Previously after initial window creation of a richedit control with the ES_DISABLENOSCROLL window style flag the scrollbar would be shown but not disabled. This patch fixes this issue by explicitly disabling and showing the scrollbar. --- dlls/riched20/editor.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 4cd72c85cd9..7ffb7cbd17b 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3842,23 +3842,29 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, } case WM_CREATE: { - SCROLLINFO si; + INT max; ME_SetDefaultFormatRect(editor); - si.cbSize = sizeof(si); - si.fMask = SIF_PAGE | SIF_RANGE; + max = (editor->styleFlags & ES_DISABLENOSCROLL) ? 1 : 0; + if (~editor->styleFlags & ES_DISABLENOSCROLL || editor->styleFlags & WS_VSCROLL) + ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, 0, max, TRUE); + + if (~editor->styleFlags & ES_DISABLENOSCROLL || editor->styleFlags & WS_HSCROLL) + ITextHost_TxSetScrollRange(editor->texthost, SB_HORZ, 0, max, TRUE); + if (editor->styleFlags & ES_DISABLENOSCROLL) - si.fMask |= SIF_DISABLENOSCROLL; - si.nMax = (si.fMask & SIF_DISABLENOSCROLL) ? 1 : 0; - si.nMin = 0; - si.nPage = 0; - if (editor->hWnd) { - SetScrollInfo(editor->hWnd, SB_VERT, &si, TRUE); - SetScrollInfo(editor->hWnd, SB_HORZ, &si, TRUE); - } else { - ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, si.nMin, si.nMax, TRUE); - ITextHost_TxSetScrollRange(editor->texthost, SB_HORZ, si.nMin, si.nMax, TRUE); + { + if (editor->styleFlags & WS_VSCROLL) + { + ITextHost_TxEnableScrollBar(editor->texthost, SB_VERT, ESB_DISABLE_BOTH); + ITextHost_TxShowScrollBar(editor->texthost, SB_VERT, TRUE); + } + if (editor->styleFlags & WS_HSCROLL) + { + ITextHost_TxEnableScrollBar(editor->texthost, SB_HORZ, ESB_DISABLE_BOTH); + ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, TRUE); + } } ME_CommitUndo(editor); -- 2.11.4.GIT