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. Moving the text

Moving the text

Scheduled Pinned Locked Moved C / C++ / MFC
question
22 Posts 7 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.
  • U User 3037427

    Hi all, I want my text to be moved rom left to right and come back to left. How can i do this??? :confused:

    E Offline
    E Offline
    Eytukan
    wrote on last edited by
    #4

    Tried this one for you hehe it works,(If you actually mean a simpler one like this :-D) Declare Globals: CString cs="sruti"; clickCount=0; //m_TextOut -> CEdit onToMoveLeft() { cs =" "+cs; clickCount++; m_TextOut.SetWindowText(cs); } onToMoveRight() { cs=cs.Right(clickCount); clickCount--; m_TextOut.SetWindowText(cs); } Now it simulates a movement., Is this you want?:~


    --[V]-- [My Current Status]

    U 1 Reply Last reply
    0
    • U User 3037427

      Hi all, I want my text to be moved rom left to right and come back to left. How can i do this??? :confused:

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

      sruti_p wrote:

      want my text to be moved rom left to right and come back to left.

      What About    CPaintDC dc(this)    for(x = 100 ;x<300;x+=5)  {    dc.TextOut(x,100,"Alok");  }

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

      N 1 Reply Last reply
      0
      • T ThatsAlok

        sruti_p wrote:

        want my text to be moved rom left to right and come back to left.

        What About    CPaintDC dc(this)    for(x = 100 ;x<300;x+=5)  {    dc.TextOut(x,100,"Alok");  }

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

        N Offline
        N Offline
        Nishad S
        wrote on last edited by
        #6

        ThatsAlok wrote:

        CPaintDC dc(this)

        Where will you use this code...? - NS -

        T 1 Reply Last reply
        0
        • U User 3037427

          Hi all, I want my text to be moved rom left to right and come back to left. How can i do this??? :confused:

          Y Offline
          Y Offline
          yang__lee
          wrote on last edited by
          #7

          use above code but put Sleep (1000) ; so application halts for some time giving you animation result or else you will find text on its place only. Leya

          E S 2 Replies Last reply
          0
          • N Nishad S

            ThatsAlok wrote:

            CPaintDC dc(this)

            Where will you use this code...? - NS -

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

            NS17 wrote:

            Where will you use this code...?

            Offcourse in In WM_PAINT handller :)

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

            N 1 Reply Last reply
            0
            • Y yang__lee

              use above code but put Sleep (1000) ; so application halts for some time giving you animation result or else you will find text on its place only. Leya

              E Offline
              E Offline
              Eytukan
              wrote on last edited by
              #9

              Sleep?? It's better to make use a Timer if at all he needs to automate it.


              --[V]-- [My Current Status]

              1 Reply Last reply
              0
              • Y yang__lee

                use above code but put Sleep (1000) ; so application halts for some time giving you animation result or else you will find text on its place only. Leya

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

                You can't go Sleeping all over the place. The application will not be responsive and repaint itself if its Sleeping instead of running a message pump. 9/10 Sleep calls I see shouldn't be there. Steve

                1 Reply Last reply
                0
                • T ThatsAlok

                  NS17 wrote:

                  Where will you use this code...?

                  Offcourse in In WM_PAINT handller :)

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                  N Offline
                  N Offline
                  Nishad S
                  wrote on last edited by
                  #11

                  But you will not get the expected result if you write it in OnPaint(). You need a timer to get the result. - NS -

                  T 1 Reply Last reply
                  0
                  • _ _AnsHUMAN_

                    You want to do it through GDI or have you got the text in some text or label control. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

                    U Offline
                    U Offline
                    User 3037427
                    wrote on last edited by
                    #12

                    I want my text to be moved from left to right and then to left repeatedly. I want to do this without using the thread and without GDI. How can i do this? THanks for ur reply.:)

                    _ T 2 Replies Last reply
                    0
                    • U User 3037427

                      I want my text to be moved from left to right and then to left repeatedly. I want to do this without using the thread and without GDI. How can i do this? THanks for ur reply.:)

                      _ Offline
                      _ Offline
                      _AnsHUMAN_
                      wrote on last edited by
                      #13

                      You have got the answer than http://www.codeproject.com/script/comments/forums.asp?msg=1518354&forumid=1647#xx1518354xx[^] Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

                      1 Reply Last reply
                      0
                      • E Eytukan

                        Tried this one for you hehe it works,(If you actually mean a simpler one like this :-D) Declare Globals: CString cs="sruti"; clickCount=0; //m_TextOut -> CEdit onToMoveLeft() { cs =" "+cs; clickCount++; m_TextOut.SetWindowText(cs); } onToMoveRight() { cs=cs.Right(clickCount); clickCount--; m_TextOut.SetWindowText(cs); } Now it simulates a movement., Is this you want?:~


                        --[V]-- [My Current Status]

                        U Offline
                        U Offline
                        User 3037427
                        wrote on last edited by
                        #14

                        Sorry Vunic. I am not getting it. I created a splitter window. On the top pane i want to rotate my text(just like as you in any website). Anyhow thanks for ur reply.:)

                        1 Reply Last reply
                        0
                        • N Nishad S

                          But you will not get the expected result if you write it in OnPaint(). You need a timer to get the result. - NS -

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

                          NS17 wrote:

                          But you will not get the expected result if you write it in OnPaint(). You need a timer to get the result.

                          I am just showing her example how to move text!, thought timer is one of good concept but there are concept too.. even some people doesn't prefer timer when it come to accuracy.

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                          N 1 Reply Last reply
                          0
                          • T ThatsAlok

                            NS17 wrote:

                            But you will not get the expected result if you write it in OnPaint(). You need a timer to get the result.

                            I am just showing her example how to move text!, thought timer is one of good concept but there are concept too.. even some people doesn't prefer timer when it come to accuracy.

                            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                            N Offline
                            N Offline
                            Nishad S
                            wrote on last edited by
                            #16

                            Ok. I know I don't need to tell you how to use a timer to do the text scrolling... :)

                            ThatsAlok wrote:

                            I am just showing her example how to move text!,

                            I just mention about the timer, because according to me your code was so simple, and for a beginner it will not be enough to reach the result as you said that you would write it in the paint handler. - NS -

                            T 1 Reply Last reply
                            0
                            • U User 3037427

                              I want my text to be moved from left to right and then to left repeatedly. I want to do this without using the thread and without GDI. How can i do this? THanks for ur reply.:)

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

                              sruti_p wrote:

                              I want to do this without using the thread and without GDI. How can i do this?

                              \  You can Move your Text without Thread, but it very difficult to move your text without using GDI, because for writing on Screen you have to use GDI function except if you are making console based application!

                              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                              U 1 Reply Last reply
                              0
                              • N Nishad S

                                Ok. I know I don't need to tell you how to use a timer to do the text scrolling... :)

                                ThatsAlok wrote:

                                I am just showing her example how to move text!,

                                I just mention about the timer, because according to me your code was so simple, and for a beginner it will not be enough to reach the result as you said that you would write it in the paint handler. - NS -

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

                                NS17 wrote:

                                Ok. I know I don't need to tell you how to use a timer to do the text scrolling... :)

                                naah don't take me wrong, may be i don't know about how timer work ! :)

                                NS17 wrote:

                                just mention about the timer, because according to me your code was so simple, and for a beginner it will not be enough to reach the result as you said that you would write it in the paint handler.

                                actually just remeber  the Console Days, when you program on Turbo C++, i believe there you have programmed many character moving program :)

                                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                                N 1 Reply Last reply
                                0
                                • T ThatsAlok

                                  NS17 wrote:

                                  Ok. I know I don't need to tell you how to use a timer to do the text scrolling... :)

                                  naah don't take me wrong, may be i don't know about how timer work ! :)

                                  NS17 wrote:

                                  just mention about the timer, because according to me your code was so simple, and for a beginner it will not be enough to reach the result as you said that you would write it in the paint handler.

                                  actually just remeber  the Console Days, when you program on Turbo C++, i believe there you have programmed many character moving program :)

                                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                                  N Offline
                                  N Offline
                                  Nishad S
                                  wrote on last edited by
                                  #19

                                  ThatsAlok wrote:

                                  may be i don't know about how timer work !

                                  Please don't take my comment as teasing. :(

                                  ThatsAlok wrote:

                                  actually just remeber the Console Days

                                  But for a beginner, I am not sure he/she can interpret what you mean. That's why I said that. - NS -

                                  T 1 Reply Last reply
                                  0
                                  • N Nishad S

                                    ThatsAlok wrote:

                                    may be i don't know about how timer work !

                                    Please don't take my comment as teasing. :(

                                    ThatsAlok wrote:

                                    actually just remeber the Console Days

                                    But for a beginner, I am not sure he/she can interpret what you mean. That's why I said that. - NS -

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

                                    NS17 wrote:

                                    Please don't take my comment as teasing. :(

                                    Buddy don't take tension, i am just kiddin :)

                                    NS17 wrote:

                                    I am not sure he/she can interpret what you mean. That's why I said that.

                                    Yeap you are write, it will very difficult for grasp the concept OnPaint Handller. also by carefull study, it very difficuly to see moving text at In OnPaint handller as screen have to be repainted for Printing text!

                                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                                    1 Reply Last reply
                                    0
                                    • T ThatsAlok

                                      sruti_p wrote:

                                      I want to do this without using the thread and without GDI. How can i do this?

                                      \  You can Move your Text without Thread, but it very difficult to move your text without using GDI, because for writing on Screen you have to use GDI function except if you are making console based application!

                                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                                      U Offline
                                      U Offline
                                      User 3037427
                                      wrote on last edited by
                                      #21

                                      Then how can i do this using GDI.

                                      T 1 Reply Last reply
                                      0
                                      • U User 3037427

                                        Then how can i do this using GDI.

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

                                        sruti_p wrote:

                                        Then how can i do this using GDI.

                                        You have to learn simple Screen Painting and Screen Writing for that. which you book are you refering these days

                                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

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

                                        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