Select Row in ListView
-
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);
-
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);
-
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);
-
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);
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!) -
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!)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); }