From: Chris on
Hello, I'm using the Listview from MS Common Controls 5.0, because it supports XP style and I'm
adding checkboxes with the LVS_EX_CHECKBOXES constant.
This works fine, but when the user clicks on a checkbox, the data from that row needs to be copied to
an other Listview and some other things need to be done. The problem is that the 5.0 Listview doesn't
have an ItemCheck event, like the 6.0 Listview does.
I can get the state of the checkbox manually with SendMessage and the LVM_GETITEMSTATE
constant, but then I have to loop through the Listview continuously. Is there a way to create an
ItemCheck event or to somehow figure out when a checkbox is ticked by the user and which one?
Thanks,
Chris


From: DanS on
Chris <no(a)spam.com> wrote in
news:afb33$4bacd3f6$5ed66c20$5528(a)cache5.tilbu1.nb.home.nl:

> Hello, I'm using the Listview from MS Common Controls 5.0,
> because it supports XP style and I'm adding checkboxes with
> the LVS_EX_CHECKBOXES constant. This works fine, but when
> the user clicks on a checkbox, the data from that row needs
> to be copied to an other Listview and some other things
> need to be done. The problem is that the 5.0 Listview
> doesn't have an ItemCheck event, like the 6.0 Listview
> does. I can get the state of the checkbox manually with
> SendMessage and the LVM_GETITEMSTATE constant, but then I
> have to loop through the Listview continuously. Is there a
> way to create an ItemCheck event or to somehow figure out
> when a checkbox is ticked by the user and which one?
> Thanks, Chris

Does the ItemClick event fire when checked/unchecked ?

What events DO fire when checked/unchecked ?

Maybe MouseUp & HitTest the location then check the items Check
state.
From: Nobody on
You can subclass the parent window(usually the form), and watch for
WM_NOTIFY, then look for LVN_ITEMCHANGED in NMHDR.code. If you search the
newsgroups for "vb LVN_ITEMCHANGED", you will probably find samples.



From: Chris on
The ItemClick event does not fire, but I didn't check the MouseUp event and that works
fine with HitTest, SendMessage and LVM_GETITEMSTATE.

Thank you,
Chris

From: Chris on
I tried subclassing, but couldn't find a way to get the index of the ticked checkbox, but
using the MouseUp event with HitTest, SendMessage and LVM_GETITEMSTATE works fine too.

Thanks you,
Chris