CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Posts
    20

    using SetItemState

    Hi there

    for(int i=0;i<=5;i++)
    {
    m_ImageList.SetItemState(i,LVIS_SELECTED,LVIS_SELECTED);
    }

    How to selete more than one item by using SetItemState function?


    I can just get one or last one item being seleted.

    I need to selete multiple items when i start i dialog.

  2. #2
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Saying "How to selete more than one item by using SetItemState function?" seems to say you are tring to use SetItemState to find items. That might be why you did not get a response sooner.

    The documentation of SetItemState is not as complete as it should be but it should be obvious that a "state" value is not the same as a "mask" value; therefore don't use LVIS_SELECTED for the mask value.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  3. #3
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039
    Hi...have you checked that the resource properties to ensure that 'single selection' is off? Hope this helps.

  4. #4
    Join Date
    Aug 2003
    Posts
    20
    Sorry for asking the wrong question.

    i use CListCtrl to show Bitmap, and i want all of Bitmaps getting focus automatically when i open my dialog. Therefore, i use ClistCtrl's function SetItemstate to set each Bitmap's focus,but only one bitmap get focus.

    Thanks

  5. #5
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Did you find the flag value to use for the mask in SetItemState?
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  6. #6
    Join Date
    Aug 2003
    Posts
    20
    Thank you for your help.

    Do you mean "LVIS_FOCUSED","'LVIS_CUT".........

    I found "LVIS_FOCUSED", but the MSDN states " The item has the foucs, so it is surrounded by a standard focus rectangle, Although more than one item may be selected, only one item can have the focus."

  7. #7
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Values beginning with LVIS are for state values. For the mask, you need flag values, which begin with LVIF. Look at the LVITEM structure.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

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