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.
This commit is contained in:
Dylan Smith 2009-07-16 18:45:59 -04:00 committed by Alexandre Julliard
parent a80247f58b
commit eddccdd1f2

View File

@ -3842,23 +3842,29 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
} }
case WM_CREATE: case WM_CREATE:
{ {
SCROLLINFO si; INT max;
ME_SetDefaultFormatRect(editor); ME_SetDefaultFormatRect(editor);
si.cbSize = sizeof(si); max = (editor->styleFlags & ES_DISABLENOSCROLL) ? 1 : 0;
si.fMask = SIF_PAGE | SIF_RANGE; 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) if (editor->styleFlags & ES_DISABLENOSCROLL)
si.fMask |= SIF_DISABLENOSCROLL; {
si.nMax = (si.fMask & SIF_DISABLENOSCROLL) ? 1 : 0; if (editor->styleFlags & WS_VSCROLL)
si.nMin = 0; {
si.nPage = 0; ITextHost_TxEnableScrollBar(editor->texthost, SB_VERT, ESB_DISABLE_BOTH);
if (editor->hWnd) { ITextHost_TxShowScrollBar(editor->texthost, SB_VERT, TRUE);
SetScrollInfo(editor->hWnd, SB_VERT, &si, TRUE); }
SetScrollInfo(editor->hWnd, SB_HORZ, &si, TRUE); if (editor->styleFlags & WS_HSCROLL)
} else { {
ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, si.nMin, si.nMax, TRUE); ITextHost_TxEnableScrollBar(editor->texthost, SB_HORZ, ESB_DISABLE_BOTH);
ITextHost_TxSetScrollRange(editor->texthost, SB_HORZ, si.nMin, si.nMax, TRUE); ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, TRUE);
}
} }
ME_CommitUndo(editor); ME_CommitUndo(editor);