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. How to select items in a ListCtrl programmatically

How to select items in a ListCtrl programmatically

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
5 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.
  • V Offline
    V Offline
    Vincent Ye
    wrote on last edited by
    #1

    Hi, All, How can I select item in a ListCtrl programmatically? the ListCtrl is in Report View mode. Thanks in advance

    C T 2 Replies Last reply
    0
    • V Vincent Ye

      Hi, All, How can I select item in a ListCtrl programmatically? the ListCtrl is in Report View mode. Thanks in advance

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Use this...

      SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);

      ... or even this:

      SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);

      Tomasz Sowinski -- http://www.shooltz.com

      Free your mind and your ass will follow.

      V 1 Reply Last reply
      0
      • V Vincent Ye

        Hi, All, How can I select item in a ListCtrl programmatically? the ListCtrl is in Report View mode. Thanks in advance

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        SetItemState (idx, LVIS_SELECTED, LVIS_SELECTED);


        For men use, if they have an evil turn, to write it in marble: and whoso doth us a good turn we write it in dust. -- Sir Thomas More

        image effects!

        V 1 Reply Last reply
        0
        • T Tomasz Sowinski

          Use this...

          SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);

          ... or even this:

          SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);

          Tomasz Sowinski -- http://www.shooltz.com

          Free your mind and your ass will follow.

          V Offline
          V Offline
          Vincent Ye
          wrote on last edited by
          #4

          Thank you very much.

          1 Reply Last reply
          0
          • C Chris Losinger

            SetItemState (idx, LVIS_SELECTED, LVIS_SELECTED);


            For men use, if they have an evil turn, to write it in marble: and whoso doth us a good turn we write it in dust. -- Sir Thomas More

            image effects!

            V Offline
            V Offline
            Vincent Ye
            wrote on last edited by
            #5

            Thank you very much.

            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