CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Posts
    41

    Selecting item in a List Control

    Hi

    I am trying to select an item in a list control using the SetItemState method. The method selects the item however the item is not highlighted on screen.

    What I have at the moment is:

    ..
    m_filelist.SetItemState(nSelected,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
    ..

    This correctly selects the item I want however it is not highlighted. How can I also highlight a particular item?

    Cheers

    Robbie
    Last edited by robbiegregg; January 30th, 2007 at 05:29 AM.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Selecting item in a List Control

    Did you mean:
    Code:
    m_filelist.SetItemState(nSelected, LVIS_SELECTED|LVIS_FOCUSED, LVIF_SELECTED);
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Selecting another item in a List Control

    What is LVIF_SELECTED?

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Selecting another item in a List Control

    SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);

    works for me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured