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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. RichTextBox- How to display last line entered.

RichTextBox- How to display last line entered.

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++helptutorialquestion
8 Posts 4 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.
  • F Offline
    F Offline
    Freddie Code
    wrote on last edited by
    #1

    I'm writing a VC++ .NET application in which I need to present the user with data on an on going basis. The user always needs to see the most most recent data. I'm dumping the data to a RichTextBox. The only problem is that the richtext box keeps scrolling up to the top of the box, showing the use the first data entered. Is there a property of the richtextbox that can be changed to show the last data entered? Or is there a custom control that could do this? Thanks.

    B 1 Reply Last reply
    0
    • F Freddie Code

      I'm writing a VC++ .NET application in which I need to present the user with data on an on going basis. The user always needs to see the most most recent data. I'm dumping the data to a RichTextBox. The only problem is that the richtext box keeps scrolling up to the top of the box, showing the use the first data entered. Is there a property of the richtextbox that can be changed to show the last data entered? Or is there a custom control that could do this? Thanks.

      B Offline
      B Offline
      bneacetp
      wrote on last edited by
      #2

      If you are dumping the data one line at a time, one option might be to insert the newer info at the top instead of at the bottom. For example: 5 4 3 2 1 instead of 1 2 3 4 5 However, take a look at this article (http://www.codeproject.com/editctrl/history_edit.asp[^]) and see if this will help you out. The article uses a CEdit control instead of a rich text box but it might get you pointed in the right direction. I hope this helps. Good luck with your project. :)


      John 3:16: "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."

      F 2 Replies Last reply
      0
      • B bneacetp

        If you are dumping the data one line at a time, one option might be to insert the newer info at the top instead of at the bottom. For example: 5 4 3 2 1 instead of 1 2 3 4 5 However, take a look at this article (http://www.codeproject.com/editctrl/history_edit.asp[^]) and see if this will help you out. The article uses a CEdit control instead of a rich text box but it might get you pointed in the right direction. I hope this helps. Good luck with your project. :)


        John 3:16: "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."

        F Offline
        F Offline
        Freddie Code
        wrote on last edited by
        #3

        This looks like exactly what I need. Thanks bneacetp! :cool:

        1 Reply Last reply
        0
        • B bneacetp

          If you are dumping the data one line at a time, one option might be to insert the newer info at the top instead of at the bottom. For example: 5 4 3 2 1 instead of 1 2 3 4 5 However, take a look at this article (http://www.codeproject.com/editctrl/history_edit.asp[^]) and see if this will help you out. The article uses a CEdit control instead of a rich text box but it might get you pointed in the right direction. I hope this helps. Good luck with your project. :)


          John 3:16: "For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."

          F Offline
          F Offline
          Freddie Code
          wrote on last edited by
          #4

          OK, I'm having some trouble with Step #2 using this control in another VC 6.0 MFC project. I think it is just a MFC Wizard thing. I'm following the instructions in the Guide: 1. Include CHistoryEdit.h in your dialog class' header file. -Done, no issues :-). 2. Add member variables of type CHistoryEdit for every edit control you want to subclass. -Here is where I have issues. When I use the MFC Wizard to add a memeber variable to my Edit Box, the drop-down variable Type selection dones not show a pick for the new custom class HistoryEdit. It's like the new class is not registered with MFC or something. What am I doing wrong? :confused: 3. Subclass the edit controls in your dialog's OnInitDialog() method. - Not there yet! Thanks.

          L 1 Reply Last reply
          0
          • F Freddie Code

            OK, I'm having some trouble with Step #2 using this control in another VC 6.0 MFC project. I think it is just a MFC Wizard thing. I'm following the instructions in the Guide: 1. Include CHistoryEdit.h in your dialog class' header file. -Done, no issues :-). 2. Add member variables of type CHistoryEdit for every edit control you want to subclass. -Here is where I have issues. When I use the MFC Wizard to add a memeber variable to my Edit Box, the drop-down variable Type selection dones not show a pick for the new custom class HistoryEdit. It's like the new class is not registered with MFC or something. What am I doing wrong? :confused: 3. Subclass the edit controls in your dialog's OnInitDialog() method. - Not there yet! Thanks.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Have you added the HistoryEdit source files to the project ? The class wizard looks there. Elaine :rose: The tigress is here :-D

            F 1 Reply Last reply
            0
            • L Lost User

              Have you added the HistoryEdit source files to the project ? The class wizard looks there. Elaine :rose: The tigress is here :-D

              F Offline
              F Offline
              Freddie Code
              wrote on last edited by
              #6

              I did have the HistoryEdit.cpp source file as one of the source files and that still did not let the Wizard find the class. I did discover a work-a-round. I added a member variable of one of the default MFC types "Control" and "CEdit". I then searched the code for the declaration of the variable and changed it to "HistoryEdit" type. This works and I can now use added custom control functions. However, it still would be nice to know the "right" way to do this. ie, how to make the Wizard recognize custom class types without using the back-door approach.

              L J 2 Replies Last reply
              0
              • F Freddie Code

                I did have the HistoryEdit.cpp source file as one of the source files and that still did not let the Wizard find the class. I did discover a work-a-round. I added a member variable of one of the default MFC types "Control" and "CEdit". I then searched the code for the declaration of the variable and changed it to "HistoryEdit" type. This works and I can now use added custom control functions. However, it still would be nice to know the "right" way to do this. ie, how to make the Wizard recognize custom class types without using the back-door approach.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                It's the header file the class wizard looks in for the declarations and the CPP file for the references. Always add both to the project source files. Elaine :rose: The tigress is here :-D

                1 Reply Last reply
                0
                • F Freddie Code

                  I did have the HistoryEdit.cpp source file as one of the source files and that still did not let the Wizard find the class. I did discover a work-a-round. I added a member variable of one of the default MFC types "Control" and "CEdit". I then searched the code for the declaration of the variable and changed it to "HistoryEdit" type. This works and I can now use added custom control functions. However, it still would be nice to know the "right" way to do this. ie, how to make the Wizard recognize custom class types without using the back-door approach.

                  J Offline
                  J Offline
                  Jose Lamas Rios
                  wrote on last edited by
                  #8

                  Freddie Code wrote: However, it still would be nice to know the "right" way to do this. ie, how to make the Wizard recognize custom class types without using the back-door approach. I'm not sure if it's possible to make the Wizard recognize those classes, but what you did is right anyway. Just to clarify, both of the following options will work: 1 - You manually declare new variable members in your dialog class and then manually subclass the windows in OnInitDialog(). 2 - You add a variable member through the wizard, which also adds the subclassing in DoDataExchange(), which is called through CDialog::OnInitDialog(), and then manually change the class of the control in your dialog class declaration. The latter is easier, of course :) -- jlr http://jlamas.blogspot.com/[^]

                  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