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. Select Row in ListView

Select Row in ListView

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 4 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.
  • R Offline
    R Offline
    RadioOpa
    wrote on last edited by
    #1

    When selecting an item in a listview I can only highlight the first item, not the entire row. Where´s the problem ? int nItem = m_Liste.GetNextSelectedItem(pos); m_Liste.SetItemState( nItem, LVIS_SELECTED, LVIS_SELECTED | LVIS_FOCUSED); m_Liste.EnsureVisible( nItem, FALSE);

    R R 2 Replies Last reply
    0
    • R RadioOpa

      When selecting an item in a listview I can only highlight the first item, not the entire row. Where´s the problem ? int nItem = m_Liste.GetNextSelectedItem(pos); m_Liste.SetItemState( nItem, LVIS_SELECTED, LVIS_SELECTED | LVIS_FOCUSED); m_Liste.EnsureVisible( nItem, FALSE);

      R Offline
      R Offline
      rrrado
      wrote on last edited by
      #2

      Check LVS_EX_FULLROWSELECT extended style


      rrrado

      1 Reply Last reply
      0
      • R RadioOpa

        When selecting an item in a listview I can only highlight the first item, not the entire row. Where´s the problem ? int nItem = m_Liste.GetNextSelectedItem(pos); m_Liste.SetItemState( nItem, LVIS_SELECTED, LVIS_SELECTED | LVIS_FOCUSED); m_Liste.EnsureVisible( nItem, FALSE);

        R Offline
        R Offline
        RChin
        wrote on last edited by
        #3

        Set the LVS_EX_FULLROWSELECT extended style.


        I Dream of Absolute Zero

        R 1 Reply Last reply
        0
        • R RChin

          Set the LVS_EX_FULLROWSELECT extended style.


          I Dream of Absolute Zero

          R Offline
          R Offline
          RadioOpa
          wrote on last edited by
          #4

          Thanks for you response, but it didn´t help: int nItem = m_Liste.GetNextSelectedItem(pos); m_Liste.SetItemState( nItem, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT | LVIS_FOCUSED); m_Liste.EnsureVisible( nItem, FALSE);

          J 1 Reply Last reply
          0
          • R RadioOpa

            Thanks for you response, but it didn´t help: int nItem = m_Liste.GetNextSelectedItem(pos); m_Liste.SetItemState( nItem, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT | LVIS_FOCUSED); m_Liste.EnsureVisible( nItem, FALSE);

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

            When your ListView control is first created or attached to (like in CDialog::OnInitDialog(...)):     m_Liste.SetExtendedStyle( LVS_EX_FULLROWSELECT );    Peace! -=- James


            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!
            Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
            DeleteFXPFiles & CheckFavorites (Please rate this post!)

            R 1 Reply Last reply
            0
            • J James R Twine

              When your ListView control is first created or attached to (like in CDialog::OnInitDialog(...)):     m_Liste.SetExtendedStyle( LVS_EX_FULLROWSELECT );    Peace! -=- James


              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!
              Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
              DeleteFXPFiles & CheckFavorites (Please rate this post!)

              R Offline
              R Offline
              RadioOpa
              wrote on last edited by
              #6

              All right, I´ve got it. Thanks a lot. m_Liste.SetExtendedStyle( LVS_EX_FULLROWSELECT); POSITION pos; pos = m_Liste.GetFirstSelectedItemPosition(); if( pos == NULL) { *pResult = 0; return; } else { // Use the following to display an entire row as selected // should you need to do so. int nItem = m_Liste.GetNextSelectedItem(pos); m_Liste.SetItemState( nItem, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT | LVIS_FOCUSED); m_Liste.EnsureVisible( nItem, FALSE); }

              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