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. Need to send info???

Need to send info???

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 2 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
    Larsson
    wrote on last edited by
    #1

    How can I send text out to a List control in a loop? for(int i=0; i<10; i++) { Sleep(1000); m_list.AddString("Hello"); } Now when im in the loop I dont see the text updateing but when the loop is finish then all the text is shown. How can I make so I can see the test updateing at ones?

    R 1 Reply Last reply
    0
    • L Larsson

      How can I send text out to a List control in a loop? for(int i=0; i<10; i++) { Sleep(1000); m_list.AddString("Hello"); } Now when im in the loop I dont see the text updateing but when the loop is finish then all the text is shown. How can I make so I can see the test updateing at ones?

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      A call to Sleep() isn't required, unless you want to convey the illusion of "progress". Try this:

      for (int i=0; (i < 10); i++) {
      Sleep (1000);
      int nIndex = m_listCtrl.InsertItem (i, "Hello");
      m_listCtrl.EnsureVisible (nIndex, TRUE);
      m_listCtrl.UpdateWindow();
      }

      /ravi

      This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      L 2 Replies Last reply
      0
      • R Ravi Bhavnani

        A call to Sleep() isn't required, unless you want to convey the illusion of "progress". Try this:

        for (int i=0; (i < 10); i++) {
        Sleep (1000);
        int nIndex = m_listCtrl.InsertItem (i, "Hello");
        m_listCtrl.EnsureVisible (nIndex, TRUE);
        m_listCtrl.UpdateWindow();
        }

        /ravi

        This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

        L Offline
        L Offline
        Larsson
        wrote on last edited by
        #3

        I dont have 'InsertItem' only InserString or AddString.

        R 1 Reply Last reply
        0
        • R Ravi Bhavnani

          A call to Sleep() isn't required, unless you want to convey the illusion of "progress". Try this:

          for (int i=0; (i < 10); i++) {
          Sleep (1000);
          int nIndex = m_listCtrl.InsertItem (i, "Hello");
          m_listCtrl.EnsureVisible (nIndex, TRUE);
          m_listCtrl.UpdateWindow();
          }

          /ravi

          This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

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

          Its a CListBox i use.

          R 1 Reply Last reply
          0
          • L Larsson

            I dont have 'InsertItem' only InserString or AddString.

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            Larsson wrote:

            I dont have 'InsertItem' only InserString or AddString.

            Then you don't have a list control. You're probably using a CListBox and will need to use SetTopIndex()[^] instead /ravi

            This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

            1 Reply Last reply
            0
            • L Larsson

              Its a CListBox i use.

              R Offline
              R Offline
              Ravi Bhavnani
              wrote on last edited by
              #6

              Right. See my earlier reply. /ravi

              This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

              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