Click to See Complete Forum and Search --> : ListView Selection & Permanent Highlights


Guido Cresto
May 16th, 1999, 04:38 PM
What is LVS_SHOWSELALWAYS supposed to do?
I want to keep the currently selected item always highlighted in the ListView
When deleting an item, eg. click on it, then delete the selected item:
ie. lvwTest.ListItems.Remove lvwTest.SelectedItem.Index, the selected item is deleted, and the currently selected index will be set
automatically but not highlighted.
Is there also a way to keep the currently selected item highlighted when focus is off the listview? Setting HideSelection = False keeps the
item as grey (as opposed to blue) with std colours, when focus is off, but the original problem still applies.
Is there a really good book for VB/Win32 that helps with such things? I am also looking for a book that deals with passing arrays and structures
containing arrays and string arrays from VB > C and C > VB.
Thanks in advance for any replies....

Chris Eastwood
May 17th, 1999, 03:10 AM
Hi

>What is LVS_SHOWSELALWAYS supposed to do?
>I want to keep the currently selected item always highlighted in the ListView

The LVS_SHOWSELALWAYS flag is the same as setting the '.HideSelection' property of the VB5/6 ListView.

>When deleting an item, eg. click on it, then delete the selected item:
>ie. lvwTest.ListItems.Remove lvwTest.SelectedItem.Index, the selected
>item is deleted, and the currently selected index will be set
>automatically but not highlighted.

Have you tried something like :


ListView1.ListItems.Remove ListView1.SelectedItem.Index
set ListView1.SelectedItem = ListView1.SelectedItem




(with '.HideSelection' = false)

I know that the second line seems a bit silly but it works fine here !


>Is there a really good book for VB/Win32 that helps with such things? I
>am also looking for a book that deals with passing arrays and structures
>containing arrays and string arrays from VB > C and C > VB.
>Thanks in advance for any replies....

There's not really a good book for VB on programming/api stuff with the Common Controls - if you know C/C++ (or enough to convert it to VB) then you *definately* can't find a better site than the CodeGuru MFC site (the granddaddy of CodeGuru) - http://www.codeguru.com. You'll find 1000's of articles on all kinds of neat stuff, most of which can be converted to VB5/6.


Regards

Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb