Click here to Skip to main content
15,883,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my MFC application i am using CRichEdit control for multiline text.
I have set the below properties for the rich edit control.

ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE | WS_EX_STATICEDGE

Vertical and Horizontal Scrollbar appears automatically when the text entered is more than the display area. This is working as expected.

I am having one clear button in my application which is to clear the text in rich edit control. But when i click the clear button vertical scrollbar disappears but the horizantal scrollbar is not disappearing.

Can anyone help me out in this?

when ever i click the clear button the below code will be exceuted.
C++
CString strConsoleInit(_T("ADB SHELL COMMAND WINDOW \n\n"));
strConsoleInit += CONSOLE_DELIMITER;
m_ADBShellConsole.SetWindowTextW(strConsoleInit);
m_ADBShellConsole.SetReadOnly(false);

//Set the text length...
long nBegin = m_ADBShellConsole.GetTextLength();
//Get no of new line char...
int nIndex = 0;
int nCount = 0;
while(true)
{
    int nPos = strConsoleInit.Find(_T('\n'),nIndex);
    if(nPos < 0)
    {
        break;
    }
    ++nCount;
    nIndex = nPos + 1;
}
//Set the text length...
m_ADBShellConsole.SetConsoleTextLength(nBegin-nCount);
m_BtnClear.EnableWindow();
((CRAPC_AgentDlg *)m_ADBShellConsole.GetParent())->Invalidate();

I m setting the rich edit control text as below

ADB SHELL COMMAND WINDOW

INPUT COMMAND :
Posted
Updated 28-Sep-11 3:46am
v2
Comments
Richard MacCutchan 28-Sep-11 5:17am    
Are you absolutely sure that you have deleted the entire content of your control?
Richard MacCutchan 28-Sep-11 9:48am    
What is an ADBShellConsole and what does SetConsoleTextLength actually do. Also if that is supposed to clear the window are you certain that the value you are passing is correct? I would suggest stepping through this code with the debugger to check what is actually happening.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900