Originally posted by: dann
How many lines can this control display?
Reply
Originally posted by: Sean
int iTextLength=0;
iTextLength = SendMessage(hwndEditControl, WM_GETTEXTLENGTH , 0, 0);
SendMessage(hwndEditControl, EM_SETSEL, iTextLength, iTextLength);
SendMessage(hwndEditControl, EM_REPLACESEL, 0, (LPARAM)(LPCTSTR)szText);
SendMessage(hwndEditControl, EM_SCROLL, SB_LINEDOWN, 0);
}
void AppendText (HWND hwndEditControl, char * szText)
{//Appends text to an edit control and scrolls down.
Originally posted by: icewolf
How can I check if the vertical scrollbar is at bottom? I only want it to auto scroll down if the scrollbar is on bottom. (like in mIRC)
Thanks.
ReplyOriginally posted by: sangjin
Thanks...
This Class is exactly the one I really needed!
Originally posted by: jon
i cant believe how much trouble this simple little
box has given me! its so simple but why doesnt it work?
my latest problem is when i restore the window (after being minimized) it blows up. this is only one of the several issues with it...
sigh..
ReplyOriginally posted by: Mike Philips
http://www.exontrol.com/sg.jsp?content=products/exeditors
Regards,
A complete collection of editors in a single file:
Mike
Originally posted by: Kim Ji Hoon
void CTestgame01View::AddString(CString msg)
{
CString strNickName;
m_pNickNameBox.GetWindowText(strNickName);
//CString strTemp="<"+strNickName+"> "+msg;
CString strTemp=msg;
strTemp+="\r\n";
int len=m_pChatBox.GetWindowTextLength();
m_pChatBox.SetSel(len,len);
m_pChatBox.ReplaceSel(strTemp);
}
Reply
Originally posted by: Decisoft
... it converts ALL edit controls to drop-downs with history: http://www.decisoft.com
ReplyOriginally posted by: Tony Smith
Can anyone help me?
Is is possible to disable the scroll functionality in the CEdit::ReplaceSel(..) function in the same way the CEdit::SetSel(..) functions does.
Originally posted by: Larry Maser
void CHistoryEdit::AppendString
// append a carriage return
str += "\r\n";
// always write the line at the end
int len = GetWindowTextLength();
// Algorithm for determining when and how much of the most obsolete
if ( ( GetLimitText() * 2 / 3 ) < (UINT)GetWindowTextLength() )
// Now make sure we discard a whole number of lines, i.e.,
int x = LineIndex ( LineFromChar ( GetWindowTextLength() / 2 ) );
}
Here's my stab at the AppendString method, combines several of the ideas from earlier comments.
(CString str)
//
// Purpose:
// Appends a text string to the history edit control.
// This method appends a carriage return
//
// Returns:
// None.
//
{
SetSel(len,len,FALSE);
ReplaceSel(str);
// text to remove. Reminds me of 1/3 1/3 1/3 rule for fuel planning in
// a power boat: 1/3 to get there, 1/3 to get back, and 1/3 reserve.
// Here, when 1/3 of the capacity of the edit control remains,
// discard the most obsolete 1/3. The most current 1/3 is never
// disturbed. GetLimitText() gets the capacity of the edit control.
// GetWindowTextLength() gets the length of the current contents.
{
// break on a line boundary, to make the display look nice
// should user scroll way back up to the top.
SetSel(0,x,TRUE);
ReplaceSel("\r\n");
len = GetWindowTextLength();
SetSel(len,len,FALSE);
}