how to detect Listctrl check box selection/deselection
-
Hi, In my application I have created Listctrl on dialog with check box option.I need to handle check box selection or deselection events.Can anyone tell me which message handle I need to take. Regards, Rekha.
Hello Hamlat, You can use CListCtrl::GetCheck()[^]. Please have a look at this article[^]. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
Hello Hamlat, You can use CListCtrl::GetCheck()[^]. Please have a look at this article[^]. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
Thanks for your replay. But I need to get check box event selection message handler not whether check box is checked or not.
hemlat wrote:
Thanks for your replay. But I need to get check box event selection message handler not whether check box is checked or not.
Doesn't matter whether you need it or not - Microsoft don't provide that. What you do have is LVN_ITEMCHANGING[^] and LVN_ITEMCHANGED[^], which are sent when an item changes in any way - it's up to you to determine if that's because a check box has changed from checked to unchecked or unchecked to checked.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
hemlat wrote:
Thanks for your replay. But I need to get check box event selection message handler not whether check box is checked or not.
Doesn't matter whether you need it or not - Microsoft don't provide that. What you do have is LVN_ITEMCHANGING[^] and LVN_ITEMCHANGED[^], which are sent when an item changes in any way - it's up to you to determine if that's because a check box has changed from checked to unchecked or unchecked to checked.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Hi, I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl. I have searched for this requirement but I did not get required result. I am not sure whether Microsoft provide this or not. I am new to MFC. Thanks for your reply. I think I need to change logic of my code dependence on existing event handlers.
-
Hi, I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl. I have searched for this requirement but I did not get required result. I am not sure whether Microsoft provide this or not. I am new to MFC. Thanks for your reply. I think I need to change logic of my code dependence on existing event handlers.
hemlat wrote:
I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl.
From MSDN [^]
Parameters pnmv Pointer to an NMLISTVIEW structure that identifies the item and specifies which of its attributes are changing.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi, I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl. I have searched for this requirement but I did not get required result. I am not sure whether Microsoft provide this or not. I am new to MFC. Thanks for your reply. I think I need to change logic of my code dependence on existing event handlers.
hemlat wrote:
I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl.
That's right. So you (YOU) need to add code to those handlers to determine whether or not an items check state has changed. Here's a hint - the checkbox is implemented as an state image overlay - look up LVIS_STATEIMAGEMASK in the list-view item state flags.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
hemlat wrote:
I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl.
From MSDN [^]
Parameters pnmv Pointer to an NMLISTVIEW structure that identifies the item and specifies which of its attributes are changing.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
hemlat wrote:
I have used both LVN_ITEMCHANGING and LVN_ITEMCHANGED . But these these are sent not only for check box selection but also for another events like adding items to Listctrl.
That's right. So you (YOU) need to add code to those handlers to determine whether or not an items check state has changed. Here's a hint - the checkbox is implemented as an state image overlay - look up LVIS_STATEIMAGEMASK in the list-view item state flags.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p