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. Text Editor as a list control?

Text Editor as a list control?

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 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.
  • J Offline
    J Offline
    Jay Hova
    wrote on last edited by
    #1

    Hi, Still new to programming....kinda confused right now. I created a MFC app to create a standard text editor.(My base class is Ceditview) I wanted to know how i could have the editor have a set string of text on it as soon as it starts. Basically I want to make it look like a List Control window. Having strings of text passes into the editor window as a display listing. But I also want to allow for regular paragraphs to be passed in? Can this be done or is there a better solution? Thanks in advance.

    M 1 Reply Last reply
    0
    • J Jay Hova

      Hi, Still new to programming....kinda confused right now. I created a MFC app to create a standard text editor.(My base class is Ceditview) I wanted to know how i could have the editor have a set string of text on it as soon as it starts. Basically I want to make it look like a List Control window. Having strings of text passes into the editor window as a display listing. But I also want to allow for regular paragraphs to be passed in? Can this be done or is there a better solution? Thanks in advance.

      M Offline
      M Offline
      Magnus Westin
      wrote on last edited by
      #2

      Use SetWindowText in OnCreate. Hard to suggest a better solution as I dont know what you want the user to do with the pre defined text. But one is to have a list control and an edit control. Magnus

      J 1 Reply Last reply
      0
      • M Magnus Westin

        Use SetWindowText in OnCreate. Hard to suggest a better solution as I dont know what you want the user to do with the pre defined text. But one is to have a list control and an edit control. Magnus

        J Offline
        J Offline
        Jay Hova
        wrote on last edited by
        #3

        I would like to use the predefined text as a column heading. The only thing is that I will have a mixed form of the things that i want to put in the editor. For example:

           Heading 1    Heading 2    Heading 3   Heading 4    Heading 5
        1    345          456          567         678          789
        2    987          876          765         654          543
        This is a line of code that will be inserted in the middle of my so called "table" of information.  There is no defined length.  This is all entered from another dialog box.
        3    123          234          345         456          567
        4    678          789          910         566          556
        

        I hope this makes it a little easier for me to understand. I originally wanted to use a ListControl, but since i need to add that paragraph, i couldn't. Unless i can expand it across the columns. Thanks again in advance.

        M 1 Reply Last reply
        0
        • J Jay Hova

          I would like to use the predefined text as a column heading. The only thing is that I will have a mixed form of the things that i want to put in the editor. For example:

             Heading 1    Heading 2    Heading 3   Heading 4    Heading 5
          1    345          456          567         678          789
          2    987          876          765         654          543
          This is a line of code that will be inserted in the middle of my so called "table" of information.  There is no defined length.  This is all entered from another dialog box.
          3    123          234          345         456          567
          4    678          789          910         566          556
          

          I hope this makes it a little easier for me to understand. I originally wanted to use a ListControl, but since i need to add that paragraph, i couldn't. Unless i can expand it across the columns. Thanks again in advance.

          M Offline
          M Offline
          Magnus Westin
          wrote on last edited by
          #4

          Then you have only the editbox, or Richedit if you want more formation options, as an option, unless you make it a little more advanced and use a grid that has support for text over several columns. There is a really good grid on Codeproject, but I dont know if it supports text over several columns. Magnus

          J 1 Reply Last reply
          0
          • M Magnus Westin

            Then you have only the editbox, or Richedit if you want more formation options, as an option, unless you make it a little more advanced and use a grid that has support for text over several columns. There is a really good grid on Codeproject, but I dont know if it supports text over several columns. Magnus

            J Offline
            J Offline
            Jay Hova
            wrote on last edited by
            #5

            Magnus, Thanks for your help. Can you tell me how I can do this though? I can't the predefined string to the editbox upon startup of the app. Can you or anyone tell me how to do that? How would I format this text? (something like setw() in a cout statement?) Thanks again.

            D 1 Reply Last reply
            0
            • J Jay Hova

              Magnus, Thanks for your help. Can you tell me how I can do this though? I can't the predefined string to the editbox upon startup of the app. Can you or anyone tell me how to do that? How would I format this text? (something like setw() in a cout statement?) Thanks again.

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

              Jay Hova wrote: How would I format this text? (something like setw() in a cout statement?) Not unless you are working on a console application. Since you've mentioned the use of an edit control and a list control, you are obviously not working on a console application, but rather a GUI application. Send formatted text to either using a CString object. It has a nice Format() method. Here's a very simple example:

              void CMyEditView::OnInitialUpdate()
              {
              CEditView::OnInitialUpdate();

              CEdit &Edit = GetEditCtrl();
              Edit.SetWindowText("Hello World");
              
              // if you want some formatted text, use this instead
              CString str;
              str.Format("2 \* 2 = %d", 2 \* 2);
              Edit.SetWindowText(str);
              

              }

              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