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. Rolling Display with Editbox

Rolling Display with Editbox

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
13 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.
  • L Offline
    L Offline
    LaHaHa
    wrote on last edited by
    #1

    I would like to know how to write a rolling display with editbox? Please help!

    C M D 3 Replies Last reply
    0
    • L LaHaHa

      I would like to know how to write a rolling display with editbox? Please help!

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      The short answer is: call SetWindowText for the edit box using a rolling buffer. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      L 1 Reply Last reply
      0
      • L LaHaHa

        I would like to know how to write a rolling display with editbox? Please help!

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        What's a rolling display ? a marquee ? For an edit box, I would generate a string with appropriate spaces and "offset" with a timer control.

        Maximilien Lincourt Your Head A Splode - Strong Bad

        L 1 Reply Last reply
        0
        • C CPallini

          The short answer is: call SetWindowText for the edit box using a rolling buffer. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

          L Offline
          L Offline
          LaHaHa
          wrote on last edited by
          #4

          Is it possible to make the text disappeared at the end of the display? How to do this? Please help!

          C 1 Reply Last reply
          0
          • M Maximilien

            What's a rolling display ? a marquee ? For an edit box, I would generate a string with appropriate spaces and "offset" with a timer control.

            Maximilien Lincourt Your Head A Splode - Strong Bad

            L Offline
            L Offline
            LaHaHa
            wrote on last edited by
            #5

            I can make the text keep moving from right to left, but the text will stop at the end. Is it possible to make the text disappeared at the end of the display? How to do this? Please help!

            J 1 Reply Last reply
            0
            • L LaHaHa

              I can make the text keep moving from right to left, but the text will stop at the end. Is it possible to make the text disappeared at the end of the display? How to do this? Please help!

              J Offline
              J Offline
              James R Twine
              wrote on last edited by
              #6

              Q&D: add spaces to the end of the text that will "push" the printable characters off the end of the control.    Peace!

              -=- James
              Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
              Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
              See DeleteFXPFiles

              L 1 Reply Last reply
              0
              • J James R Twine

                Q&D: add spaces to the end of the text that will "push" the printable characters off the end of the control.    Peace!

                -=- James
                Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
                Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
                See DeleteFXPFiles

                L Offline
                L Offline
                LaHaHa
                wrote on last edited by
                #7

                I have tried to put some space at to the end of the text, but it is still the same. Is it the problem of my method? I use C_cdc->DrawText("abcd ",7,cdcRect,DT_VCENTER|DT_SINGLELINE); or I should use other method? Please help!

                1 Reply Last reply
                0
                • L LaHaHa

                  I would like to know how to write a rolling display with editbox? Please help!

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

                  See here.

                  "Love people and use things, not love things and use people." - Unknown

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  L 1 Reply Last reply
                  0
                  • L LaHaHa

                    Is it possible to make the text disappeared at the end of the display? How to do this? Please help!

                    C Offline
                    C Offline
                    CPallini
                    wrote on last edited by
                    #9

                    A silly example:

                    // globals or class members, whatever you like...
                    TCHAR szText[]= _T("Come in here, Dear boy, have a cigar. You're gonna go far, You're gonna fly high ");
                    const int DISPLAYSIZE=10;

                    and then

                    void RollText()
                    {
                    TCHAR szBuff[DISPLAYSIZE+1];
                    static int iStart = 0;
                    static int LEN = _tcslen(szText);

                    szBuff[DISPLAYSIZE] = _T('\0');

                    int i;
                    for (i=0; i<DISPLAYSIZE; i++)
                    {
                    szBuff[i] = szText[(iStart+i) % LEN];
                    }

                    SetDlgItemText(IDC_ROLLEDIT, szBuff);

                    iStart++;
                    iStart %= LEN;
                    }

                    Each time is called, RollText roll the text a character on the left in the edit box. BTW code has mere illustrative purposes: you should code it better. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                    L N 2 Replies Last reply
                    0
                    • D David Crow

                      See here.

                      "Love people and use things, not love things and use people." - Unknown

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      L Offline
                      L Offline
                      LaHaHa
                      wrote on last edited by
                      #10

                      I think it is a very good example for me! Many thanks!

                      1 Reply Last reply
                      0
                      • C CPallini

                        A silly example:

                        // globals or class members, whatever you like...
                        TCHAR szText[]= _T("Come in here, Dear boy, have a cigar. You're gonna go far, You're gonna fly high ");
                        const int DISPLAYSIZE=10;

                        and then

                        void RollText()
                        {
                        TCHAR szBuff[DISPLAYSIZE+1];
                        static int iStart = 0;
                        static int LEN = _tcslen(szText);

                        szBuff[DISPLAYSIZE] = _T('\0');

                        int i;
                        for (i=0; i<DISPLAYSIZE; i++)
                        {
                        szBuff[i] = szText[(iStart+i) % LEN];
                        }

                        SetDlgItemText(IDC_ROLLEDIT, szBuff);

                        iStart++;
                        iStart %= LEN;
                        }

                        Each time is called, RollText roll the text a character on the left in the edit box. BTW code has mere illustrative purposes: you should code it better. :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                        L Offline
                        L Offline
                        LaHaHa
                        wrote on last edited by
                        #11

                        I will try it! Many thanks!

                        1 Reply Last reply
                        0
                        • C CPallini

                          A silly example:

                          // globals or class members, whatever you like...
                          TCHAR szText[]= _T("Come in here, Dear boy, have a cigar. You're gonna go far, You're gonna fly high ");
                          const int DISPLAYSIZE=10;

                          and then

                          void RollText()
                          {
                          TCHAR szBuff[DISPLAYSIZE+1];
                          static int iStart = 0;
                          static int LEN = _tcslen(szText);

                          szBuff[DISPLAYSIZE] = _T('\0');

                          int i;
                          for (i=0; i<DISPLAYSIZE; i++)
                          {
                          szBuff[i] = szText[(iStart+i) % LEN];
                          }

                          SetDlgItemText(IDC_ROLLEDIT, szBuff);

                          iStart++;
                          iStart %= LEN;
                          }

                          Each time is called, RollText roll the text a character on the left in the edit box. BTW code has mere illustrative purposes: you should code it better. :)

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

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

                          CPallini wrote:

                          you should code it better.

                          mmm, are you sure? :P

                          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

                          C 1 Reply Last reply
                          0
                          • N Nelek

                            CPallini wrote:

                            you should code it better.

                            mmm, are you sure? :P

                            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

                            C Offline
                            C Offline
                            CPallini
                            wrote on last edited by
                            #13

                            Of course (but I'll bet no money)! :laugh:

                            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                            modified on Wednesday, May 21, 2008 1:39 PM

                            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