News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Tri-state Checkbox Listview Issue

Started by Custos, June 26, 2011, 11:28:23 PM

Previous topic - Next topic

Custos

Hello all.

I have coded a simple listview that uses images to display three state checkboxes.  I notice however that it has trouble when you click too fast (say regular double click speed). If you click too fast the image won't change.  I realize this is overhead in the hit detection and state changing code but I don't know how to make it any faster.  Using LVN_ITEMCHANGING notification doesn't seem possible since I have to manually change the states myself.  The LVS_EX_CHECKBOXES (two state, no imagelist) style works fine in another example but I don't think that style is compatible with a custom imagelist (item states are reported incorrectly). 

I realize this may be nitpicky but it does annoy me and I would like to remedy it.  Is it possible to make it change states fast like the other two state example? (the two state example exe is attached as well)

Custos

dedndave

i do not know the answer to your problem, but i find it interesting
you might try using PostMessage instead of SendMessage

PostMessage returns immediately, whereas SendMessage waits for the message to be handled
bad thing about PostMessage is, you can't use it to send messages that contain pointers as parms

Gunner

On windows 7 there are no issues.  Double click and image changes... even select the item and hold down the space bar and the image changes rapidly...
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

Custos

dedndave,

I'll give PostMessage a look.

Gunner,

Which exe were you testing?  checklistview.exe is a two state example.  I accidentally left 2 of my exes in the zip.  Try either base.exe or Tri-state Checkbox LV.exe.  I had a friend test my example on Win 7 and it has the same problem for him as for me (I'm using XP)

Custos

Turns out it wasn't the itemstate code.  I was only processing NM_CLICK.  What happens is that when you click twice really fast the first click message is sent as a NM_CLICK and the second mouse click is sent as a NM_DBLCLK message.  That's what it looks like to me.

I've attached the updated code for anyone interested.