Solved

ListView_SetItemState

Posted on 2000-04-15
1
1,456 Views
Last Modified: 2013-12-03
In my list view I want to highlight the item at the current cursor position. I used ListView_SetItemState with LVIS_SELECTED to highlight the item. The problem is that when the cursor moves to a new item I want to highlight the new item and clear the state of the previous item. If I have the index to the previous item how can I clear its highlighted state?
0
Comment
Question by:nadirkamal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
vessel earned 40 total points
ID: 2719048
hi nadirkamal!

This call will clear the item's highlighted state:
ListView_SetItemState(hwndX, nIndex, 0, LVIS_SELECTED);
and this will select the item:
ListView_SetItemState(hwndX, nIndex, LVIS_SELECTED, LVIS_SELECTED);

ListView_SetItemState(
    HWND hwnd,
    int i,
    UINT state, // 0 if you want to clear bits
                  // or flags (LVIS_SELECTED) to set
    UINT mask   // Bits which you want to set or clear
);
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question