Solved

ListView_SetItemState

Posted on 2000-04-15
1
1,416 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Duplicates in Aggregate Query 3 39
Enable Clear Text in Win 8.1 7 43
ODBC Connection; Switch between 2 SQL Databases VBA 11 87
GUI: DIalog Stacking and Popping in MS C++ 4 74
This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now