Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Log Window

Log Window

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SLiDeR
    wrote on last edited by
    #1

    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?

    C H 3 Replies Last reply
    0
    • S SLiDeR

      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?

      C Offline
      C Offline
      Chao Zuo
      wrote on last edited by
      #2

      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~~~~

      S 1 Reply Last reply
      0
      • C Chao Zuo

        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~~~~

        S Offline
        S Offline
        SLiDeR
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S SLiDeR

          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?

          H Offline
          H Offline
          HPSI
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • S SLiDeR

            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?

            C Offline
            C Offline
            Chao Zuo
            wrote on last edited by
            #5

            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~~~~

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups