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. Creating a Text editor

Creating a Text editor

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

    Okay, I have the window, title, toolbar, and basic commands done... All that I have to do is create the editbox (or whatever its called) for the text to go into... How would I do this? I dont really know where to place thiscodde? And how would I go about creating the editbox? Ive never really used MFC in this area before. Thanks, orcblood

    J N 2 Replies Last reply
    0
    • O orcblood

      Okay, I have the window, title, toolbar, and basic commands done... All that I have to do is create the editbox (or whatever its called) for the text to go into... How would I do this? I dont really know where to place thiscodde? And how would I go about creating the editbox? Ive never really used MFC in this area before. Thanks, orcblood

      J Offline
      J Offline
      Jaran Nilsen
      wrote on last edited by
      #2

      Well, the first thing would be: Are you using the visual tools in VisualStuio to create your application, or are you coding everything from scratch? If you use the visual tool, it's simple drag&drop to create it, and then you assign a member variable for it. If you create it from scratch it's a bit more work, but should not be too much. I do not have the code at hand now, but it should be something like this: CEdit editMyTextEditor; editMyTextEditor.Create(...); //replace "..." with parameters editMyTextEditor.MoveWindow(RECT); //Place the control within your window. editMyTextEditor.ShowWindow(); As I said I am not sure if this is the correct sequence to create the control and showing it, but hopefully you can get something out of it. I will dig out some code for you tomorrow if you have not yet found something, but right now I am going to bed!:)

      O 1 Reply Last reply
      0
      • J Jaran Nilsen

        Well, the first thing would be: Are you using the visual tools in VisualStuio to create your application, or are you coding everything from scratch? If you use the visual tool, it's simple drag&drop to create it, and then you assign a member variable for it. If you create it from scratch it's a bit more work, but should not be too much. I do not have the code at hand now, but it should be something like this: CEdit editMyTextEditor; editMyTextEditor.Create(...); //replace "..." with parameters editMyTextEditor.MoveWindow(RECT); //Place the control within your window. editMyTextEditor.ShowWindow(); As I said I am not sure if this is the correct sequence to create the control and showing it, but hopefully you can get something out of it. I will dig out some code for you tomorrow if you have not yet found something, but right now I am going to bed!:)

        O Offline
        O Offline
        orcblood
        wrote on last edited by
        #3

        Okay, I don't know how to use Visual Tools :). Is that for .net? I suppose I should say that I have MSVC++ 6.0 no thte .net version... Anyways, I would greatly appreciate you looking for some code :) I really don't know how to do it in MFC but I know how to do it in a standard C++ file - I just couldn't get the program looking the way I want... And after creating my MP3 player in MFC Ive decided that it would be easier/better to create the program in MFC. Thanks, orcblood

        J 2 Replies Last reply
        0
        • O orcblood

          Okay, I have the window, title, toolbar, and basic commands done... All that I have to do is create the editbox (or whatever its called) for the text to go into... How would I do this? I dont really know where to place thiscodde? And how would I go about creating the editbox? Ive never really used MFC in this area before. Thanks, orcblood

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          Create an MFC SDI application and choose CEditView for your view class. Your text editor is ready. Nish


          Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

          O 1 Reply Last reply
          0
          • O orcblood

            Okay, I don't know how to use Visual Tools :). Is that for .net? I suppose I should say that I have MSVC++ 6.0 no thte .net version... Anyways, I would greatly appreciate you looking for some code :) I really don't know how to do it in MFC but I know how to do it in a standard C++ file - I just couldn't get the program looking the way I want... And after creating my MP3 player in MFC Ive decided that it would be easier/better to create the program in MFC. Thanks, orcblood

            J Offline
            J Offline
            Jaran Nilsen
            wrote on last edited by
            #5

            I will look for some code tomorrow. But you also have the ability to make your application visually in VisualStudio 6.0. When you create a new application, you will have an option for what class your C...View class should be derived from. There you select CFrameView. If you use dialog based application, you don't have to select anything. Then on your resource Tab you will have all your visual parts, and you can modify them. Play around and see what you can find out... See u tomorrow then.

            1 Reply Last reply
            0
            • O orcblood

              Okay, I don't know how to use Visual Tools :). Is that for .net? I suppose I should say that I have MSVC++ 6.0 no thte .net version... Anyways, I would greatly appreciate you looking for some code :) I really don't know how to do it in MFC but I know how to do it in a standard C++ file - I just couldn't get the program looking the way I want... And after creating my MP3 player in MFC Ive decided that it would be easier/better to create the program in MFC. Thanks, orcblood

              J Offline
              J Offline
              Jaran Nilsen
              wrote on last edited by
              #6

              Ahhh, ok, I am unable to go to bed before this is solved:P Well, here's the code. Three lines that's all that's needed: CEdit m_editEditor; m_editEditor.Create(ES_AUTOHSCROLL | ES_LEFT,CRect(50,50,150,70),this,NULL); m_editEditor.ShowWindow(SW_NORMAL); VoilĂ ! This creates the most basic single line control. You can change the CRect parameters to change the size, and you change the ES_ values to change the look and behaviour of the control. The last parameter is the controls ID, which I could not be bothered to make. but it's simply a #define IDC_EDIT_MYEDIT 100 statement to create that.. Well, hope this sorted things out. NOW i have to sleep;) Good luck with your programming. -Jaran

              O 1 Reply Last reply
              0
              • J Jaran Nilsen

                Ahhh, ok, I am unable to go to bed before this is solved:P Well, here's the code. Three lines that's all that's needed: CEdit m_editEditor; m_editEditor.Create(ES_AUTOHSCROLL | ES_LEFT,CRect(50,50,150,70),this,NULL); m_editEditor.ShowWindow(SW_NORMAL); VoilĂ ! This creates the most basic single line control. You can change the CRect parameters to change the size, and you change the ES_ values to change the look and behaviour of the control. The last parameter is the controls ID, which I could not be bothered to make. but it's simply a #define IDC_EDIT_MYEDIT 100 statement to create that.. Well, hope this sorted things out. NOW i have to sleep;) Good luck with your programming. -Jaran

                O Offline
                O Offline
                orcblood
                wrote on last edited by
                #7

                Wow thanks for your help. I just have one problem about where to place this code - that is if its for coding straight into the program without using the class wiz... Where would I place this code about? Ive tried in some differenft spots and it doesn't really seem to be working too good :). orcblood

                J 1 Reply Last reply
                0
                • O orcblood

                  Wow thanks for your help. I just have one problem about where to place this code - that is if its for coding straight into the program without using the class wiz... Where would I place this code about? Ive tried in some differenft spots and it doesn't really seem to be working too good :). orcblood

                  J Offline
                  J Offline
                  Jaran Nilsen
                  wrote on last edited by
                  #8

                  Well you should put it in your init or startup function, where you define controls, set the window size...

                  1 Reply Last reply
                  0
                  • N Nish Nishant

                    Create an MFC SDI application and choose CEditView for your view class. Your text editor is ready. Nish


                    Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]

                    O Offline
                    O Offline
                    orcblood
                    wrote on last edited by
                    #9

                    How would I get rid of the MFC logo? orcblood

                    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