CEdit control scroll bar problem
-
Hello all I've a CEdit control which has multiline and vscrollbar properties set. The problem I'm having is whenever the text exceeds the editbox size vertical scroll bar is not scrolling along with the text downwards. Instead I need to scroll the vertical bar manually to see what's there in the edit box. If anyone knows how to solve this problem, pls help me. Many thanks for your help. Hari.
-
Hello all I've a CEdit control which has multiline and vscrollbar properties set. The problem I'm having is whenever the text exceeds the editbox size vertical scroll bar is not scrolling along with the text downwards. Instead I need to scroll the vertical bar manually to see what's there in the edit box. If anyone knows how to solve this problem, pls help me. Many thanks for your help. Hari.
You mean if you insert text programmatically, right? If so, then you must scroll the text manually after setting the caret at the end (no MFC here...):
int textLength = ::GetWindowTextLength(hWndEdit);
::SendMessage(hWndEdit, EM_SETSEL, (WPARAM)textLength, (LPARAM)textLength);
::SendMessage(hWndEdit, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);-- Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so. (Douglas Adams) -
You mean if you insert text programmatically, right? If so, then you must scroll the text manually after setting the caret at the end (no MFC here...):
int textLength = ::GetWindowTextLength(hWndEdit);
::SendMessage(hWndEdit, EM_SETSEL, (WPARAM)textLength, (LPARAM)textLength);
::SendMessage(hWndEdit, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);-- Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so. (Douglas Adams)Hello Johann Thank you very much for the reply. Your code solved my problem. Thanks a lot. Hari.