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. how to show only 10 lines in edit box

how to show only 10 lines in edit box

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
7 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.
  • R Offline
    R Offline
    rajneshmalik
    wrote on last edited by
    #1

    hi i run a thread to show some line in edit box and in every second thread add one line but i want to show only last added ten lines in edit box,how is this possible thank you

    R D 2 Replies Last reply
    0
    • R rajneshmalik

      hi i run a thread to show some line in edit box and in every second thread add one line but i want to show only last added ten lines in edit box,how is this possible thank you

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      If I understand it right, your question boils down to: "How can I update the contents in an edit box?" And the answer is, with the help of a member variable.

      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. ...formerly known as brahmma Codeproject.com: Visual C++ MVP

      R 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        If I understand it right, your question boils down to: "How can I update the contents in an edit box?" And the answer is, with the help of a member variable.

        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. ...formerly known as brahmma Codeproject.com: Visual C++ MVP

        R Offline
        R Offline
        rajneshmalik
        wrote on last edited by
        #3

        hi rajesh you r absolutely right.can u tell me with the help of some code

        R 1 Reply Last reply
        0
        • R rajneshmalik

          hi rajesh you r absolutely right.can u tell me with the help of some code

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          There is no serious coding. Add a member variable to your edit control and name it as m_str. Now, you can alter the value of this variable like: m_str = _T("some new value"); and then call UpdateData(false); to reflect it on the screen.

          Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. ...formerly known as brahmma Codeproject.com: Visual C++ MVP

          R 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            There is no serious coding. Add a member variable to your edit control and name it as m_str. Now, you can alter the value of this variable like: m_str = _T("some new value"); and then call UpdateData(false); to reflect it on the screen.

            Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. ...formerly known as brahmma Codeproject.com: Visual C++ MVP

            R Offline
            R Offline
            rajneshmalik
            wrote on last edited by
            #5

            i think u r not understanding my problem.i am able to show string in the edit box.but my actual problem is that in every one second i am adding on line.and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted

            R 1 Reply Last reply
            0
            • R rajneshmalik

              hi i run a thread to show some line in edit box and in every second thread add one line but i want to show only last added ten lines in edit box,how is this possible thank you

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              How about keeping the 10 lines in a CStringArray (or similar) object instead? Then the edit control can be updated from this object. Does this sound plausible?

              "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              1 Reply Last reply
              0
              • R rajneshmalik

                i think u r not understanding my problem.i am able to show string in the edit box.but my actual problem is that in every one second i am adding on line.and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #7

                rajneshmalik wrote:

                and only want to show 10 lines means i want to erase the one oldest line when the one new line is inserted

                Use a CStringList to accomplish the same. Look at CStringList::RemoveHead() function. Your task would become easy with it.

                Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. ...formerly known as brahmma Codeproject.com: Visual C++ MVP

                modified on Tuesday, January 08, 2008 9:44:03 AM

                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