Hi,
This time, I think, I found a real bug
Listview MouseUp and MouseDownEvents
When I click on stateimage (Windows 7 and Up) hitTestDetails returns 67108928 &h4000040 instead of 64 &H40 and also other constants are different.
Clicking on itemlabel returns 67108868 and item returns 4 instead of 70
Any ideas?
Regards
Meelis
StateImage&HitTestDetails
Re: StateImage&HitTestDetails
Hi,
I'm afraid you didn't find a bug. I think you missed that the hit-test codes are not mutually exclusive, but can be combined.
&H4000040 is the result of (&H4000000 Or &H40). &H4000000 is htContent, and &H40 is htItemStateImage. So the hit point lies within the item's content as well as within the item's state image - and this is where you clicked. The flag htContent is new for Windows Vista and up. Microsoft has defined the state image to be part of the item's content.
&H4000004 is the result of (&H4000000 Or &H4). &H4 is htItemLabel. So the hit point lies within the item's content as well as within the item's label - and this is where you clicked.
I suppose with 70 you mean htItem (&H46)? Well, this one is the combination (binary Or) of htItemIcon, htItemLabel, and htItemStateImage (&H2 Or &H4 Or &H40). You can use htItem if you're not interested in the exact part of an item that has been hit. So instead of:
you can just write:
This would also work (but is not as easy to read):
Regards
TiKu
I'm afraid you didn't find a bug. I think you missed that the hit-test codes are not mutually exclusive, but can be combined.
&H4000040 is the result of (&H4000000 Or &H40). &H4000000 is htContent, and &H40 is htItemStateImage. So the hit point lies within the item's content as well as within the item's state image - and this is where you clicked. The flag htContent is new for Windows Vista and up. Microsoft has defined the state image to be part of the item's content.
&H4000004 is the result of (&H4000000 Or &H4). &H4 is htItemLabel. So the hit point lies within the item's content as well as within the item's label - and this is where you clicked.
I suppose with 70 you mean htItem (&H46)? Well, this one is the combination (binary Or) of htItemIcon, htItemLabel, and htItemStateImage (&H2 Or &H4 Or &H40). You can use htItem if you're not interested in the exact part of an item that has been hit. So instead of:
Code: Select all
Dim bHitItem As Boolean
bHitItem = False
If hitTestDetails And htItemIcon Then
bHitItem = True
ElseIf hitTestDetails And htItemLabel Then
bHitItem = True
ElseIf hitTestDetails And htItemStateImage Then
bHitItem = True
End If
If bHitItem Then ...
Code: Select all
Dim bHitItem As Boolean
bHitItem = False
If hitTestDetails And htItem Then
bHitItem = True
End If
If bHitItem Then ...
Code: Select all
Dim bHitItem As Boolean
bHitItem = False
If hitTestDetails And (htItemIcon Or htItemLabel Or htItemStateImage) Then
bHitItem = True
End If
If bHitItem Then ...
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: StateImage&HitTestDetails
And thank you again!
At least, all others can learn from my mistakes and stupid questions
Regards
Meelis
At least, all others can learn from my mistakes and stupid questions
Regards
Meelis