 |

12-13-2004, 05:20 AM
|
|
Newcomer
|
|
Join Date: Nov 2003
Posts: 4
|
|
Number of selected items in listview wrong
|
Hi guys,
I'm working with a listview and i think it works wrong. If the user clicks on an empty row then will be another (not empty) automatically selected. Does someone observe this strage behaviour? I've tried to found the error and I find out that already
GetSelCountListView = SendMessage(lvw.hwnd, LVM_GETSELECTEDCOUNT, 0, 0)
returns a wrong value.
Sorry for my bad english and thanks for every help.
|
|

12-13-2004, 05:29 AM
|
 |
Privileges Suspended
|
|
Join Date: Dec 2004
Location: Sterling Heights, MI
Posts: 520
|
|
Try this:
Code:
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To ListView1.ListItems.Count
If (ListView1.ListItems(i).Selected) Then
j = j + 1
End If
Next
MsgBox j
End Sub
|
|

12-13-2004, 05:59 AM
|
|
Newcomer
|
|
Join Date: Nov 2003
Posts: 4
|
|
|
Thank you Robert, but the behaviour is the same. The message box returns 1 if the user clicks on the empty space in the listview and an empty is selected.
I don't know, why this selection happens. It is the last selected item, focus is not relevant. Anyone some idea?
|
|

12-13-2004, 06:06 AM
|
 |
Privileges Suspended
|
|
Join Date: Dec 2004
Location: Sterling Heights, MI
Posts: 520
|
|
|
Put a 'break' at the beginning of the sub, and step through it. Each time through the loop, look at the value to see if it is incrementing, and then somehow getting decremented at the end. Also, if you know, by looking at it, how many items are selected, then that is the number of times it should go through the loop. By 'stepping' through it, you will get a better idea of what is actually happening, and that might lead to why it is happening.
|
|

12-13-2004, 06:17 AM
|
|
Newcomer
|
|
Join Date: Nov 2003
Posts: 4
|
|
|
The item which be visualized as selected has .Selected = True. But why? If i deselect it than explicit then has all items .Selected Property = False. But not all the time. Than is suddenly True again. What the hell is this?
|
|

12-13-2004, 09:41 AM
|
 |
Junior Contributor
|
|
Join Date: Sep 2003
Location: Istanbul, TR
Posts: 229
|
|
haven't encountered this issue before but i believe listview is a little buggy control since i had had issues with the .Visible property, setting it to False sometimes doesn't have an effect at all. not sure but, this "may" be another bug 
|
__________________
life doesn't mean telling lies | it means enduring what you despise
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|