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. Dymamic Edit Boxes

Dymamic Edit Boxes

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 6 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.
  • C Offline
    C Offline
    Chandrasekharan P
    wrote on last edited by
    #1

    i have already created an edit box dynamically using the create function. now my requirement is when i type something on the edit box the size of the edit box should increase as the sentence gets bigger? what needs to be done for this?

    S G 2 Replies Last reply
    0
    • C Chandrasekharan P

      i have already created an edit box dynamically using the create function. now my requirement is when i type something on the edit box the size of the edit box should increase as the sentence gets bigger? what needs to be done for this?

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      You have two choices:  - Subclass the edit control.  - Handle the EN_UPDATE notification in the edit control's parent.

      Steve

      C 1 Reply Last reply
      0
      • S Stephen Hewitt

        You have two choices:  - Subclass the edit control.  - Handle the EN_UPDATE notification in the edit control's parent.

        Steve

        C Offline
        C Offline
        Chandrasekharan P
        wrote on last edited by
        #3

        will u be able to explain a little more.?

        T N 2 Replies Last reply
        0
        • C Chandrasekharan P

          will u be able to explain a little more.?

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          Chandrasekharanp wrote:

          will u be able to explain a little more.?

          search sublass here at CP, you will get answer to yo

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
          Never mind - my own stupidity is the source of every "problem" - Mixture

          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

          H 1 Reply Last reply
          0
          • T ThatsAlok

            Chandrasekharanp wrote:

            will u be able to explain a little more.?

            search sublass here at CP, you will get answer to yo

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
            Never mind - my own stupidity is the source of every "problem" - Mixture

            cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            ThatsAlok wrote:

            search sublass here at CP, you will get answer to yo

            And for more explain google is a option.;)

            T 1 Reply Last reply
            0
            • C Chandrasekharan P

              will u be able to explain a little more.?

              N Offline
              N Offline
              Nelek
              wrote on last edited by
              #6

              Adding to the answer already given... You can change the size with SetWindowPos(...)

              Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson

              1 Reply Last reply
              0
              • H Hamid Taebi

                ThatsAlok wrote:

                search sublass here at CP, you will get answer to yo

                And for more explain google is a option.;)

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                Hamid. wrote:

                And for more explain google is a option.

                ;P

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                Never mind - my own stupidity is the source of every "problem" - Mixture

                cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                1 Reply Last reply
                0
                • C Chandrasekharan P

                  i have already created an edit box dynamically using the create function. now my requirement is when i type something on the edit box the size of the edit box should increase as the sentence gets bigger? what needs to be done for this?

                  G Offline
                  G Offline
                  GauranG Shah
                  wrote on last edited by
                  #8

                  One way to do this is to change the size of the editbox dynamically using SetWindowPos() API. Use this API in WM_CHAR or EN_CHANGE notification. like below.

                  INT Widht =0; //width of the charcter
                  INT Height = 10 //height of the charcter
                  case WM_CHAR: ( or EN_CHAGE)
                  //X,Y is the position of the edit box.
                  SetWindowPos(hWndEdit,0,X,Y,Height,Width++);
                  break;

                  above code will work. But you need to take care when to grow the editbox and when to shrink it. ( i.e if someone press backspace or delete the editbox should shrink. )

                  [ Screen Capture ][ Tool Tip ][ Muliple Desktops ][Greeting Card ]

                  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