Re: Listview selected item
Quote:
Originally Posted by Henkie
I'm trying to select an item in a listview from code. However I'm having some problems.
First method should work.
Second should work if you also set
SelectListViewItemMessage.mask = LVIF_STATE;
Stupid question - do you have at least 5 items in that list?
<edited> Just noticed that you have an OWNERDRAW style. Then you had to draw items yourself. Do you check for the selected state?
Re: Listview selected item
Quote:
Originally Posted by VladimirF
<edited> Just noticed that you have an OWNERDRAW style. Then you had to draw items yourself. Do you check for the selected state?
No I don't, should I (and why)? What I'm trying to do is click on Items in a viewlist (from an application that I did not write). I can click on the item that has the focus with
Code:
SendMessage(ListViewHandle, WM_LBUTTONDBLCLK, MK_LBUTTON, 0);
Now I need to be able to get the focus on the right item.
After restarting Borland the first method Selects an Item (colours the box blue) but does not put the focus on it and using LVIS_FOCUSED | LVIS_SELECTED does not work either.
Thanks in advance for the help.
Re: Listview selected item
I've temporarily solved it with a WM_KEYDOWN and VK_DOWN / VK_UP to scroll through the Items. This is a little bit dirty. If someone knows how to do it with ListView_SetItemState please let me know.