Log Window
-
I need special log/history window control where the first line that is entered appears at the bottom, and the contents are scrolled upwards. (Like in mIRC). And it must be able to select the text. Maybe there is a way to modify CEdit class?
void EnsureVisible() { // The pointer to my edit. extern CEdit* pmyEdit; int nLines = pmyEdit->GetLineCount(); // Scroll the edit control so that the first visible line // is the last line of text. if (nLines > 0) { pmyEdit->LineScroll(nLines+1, 0); } } Then,you can call this function so that the last line is always visible. Yes,Free Code project~~~~
-
void EnsureVisible() { // The pointer to my edit. extern CEdit* pmyEdit; int nLines = pmyEdit->GetLineCount(); // Scroll the edit control so that the first visible line // is the last line of text. if (nLines > 0) { pmyEdit->LineScroll(nLines+1, 0); } } Then,you can call this function so that the last line is always visible. Yes,Free Code project~~~~
Thanks for scrolling, but i need the first line to be displayed at the bottom of CEdit. Imagine empty Edit control. Then i call some AddLine(...) function and this line appears at the bottom (not at the top like CEDit does). The second line moves first one upward and so on. Generally i need something like this http://www.codeguru.com/controls/output\_window.shtml but with ability to select text
-
I need special log/history window control where the first line that is entered appears at the bottom, and the contents are scrolled upwards. (Like in mIRC). And it must be able to select the text. Maybe there is a way to modify CEdit class?
Derive CMyEdit from CEdit. Add this method to CMyEdit:
void CMyEdit::Insert(LPCTSTR lpszText)
{
SetSel(0, 0);
ReplaceSel(lpszText);
}Add lines to edit box like this:
CMyEdit m\_edit; . . . for (int n = 0; n < 100; n++) { CString str; str.Format("This is line %d\\r\\n", n); m\_edit.Insert(str); }
Note: in Resource Editor, make sure edit box has styles multiline, vertical scroll, and auto vscroll. HPS HwndSpy - GUI developer's aid to visually locate and inspect windows. For the month of August only, use coupon code CP-81239 for 30% off.
-
I need special log/history window control where the first line that is entered appears at the bottom, and the contents are scrolled upwards. (Like in mIRC). And it must be able to select the text. Maybe there is a way to modify CEdit class?
HPSI have done it. May be, you need the first line is always visible.:-D void EnsureVisible() { // The pointer to my edit. CMyEdit m_edit; int nFirstVisible = m_edit.GetFirstVisibleLine(); // Scroll the edit control so that the first visible line // is the last line of text. if (nFirstVisible > 0) { m_edit.LineScroll(-nFirstVisible, 0); } } Yes,Free Code project~~~~