Print Page | Close Window

CXTCheckListBox check multi-select behavior

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=22452
Printed Date: 06 May 2024 at 11:55pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTCheckListBox check multi-select behavior
Posted By: franji1
Subject: CXTCheckListBox check multi-select behavior
Date Posted: 07 November 2014 at 10:58am
My CXTCheckListBox Selection style is set to "Extended" in my dialog's resource. This means I can Ctrl+Click and Shift+Click and get multi-selected items in my list box.

When I have multiple selections, when I click on one of the checkboxes, what happens is that the selection goes away and toggles the selected state of the item associated with the checkbox.

In the base MFC CCheckListBox implementation, when I do this, it maintains the selection and it checks/unchecks the entire selection. This is the behavior I desire.

Is there a way to configure the CXTCheckListBox to behave like the base CCheckListBox?

I am using XTP Extreme Toolkit Pro 13.2.

Thanks for reading!

P.S. The Samples\Controls\CheckListBox sample for CXTCheckListBox is not as good at highlighting its feature set like the other Controls examples (most are EXCELLENT to demonstrating programmatic behaviors).




Replies:
Posted By: franji1
Date Posted: 07 November 2014 at 1:41pm
I dug deeper into the XTP code, and there is a method SetSelectionCheck, which is called ONE place, in CXTCheckListBox::OnKeyDown when you hit the space bar.

So, when I multi-select and hit the SPACE BAR, it checks/unchecks the entire selection (and does not change the multi-selection state). This is the desired behavior I want when I click on a check box.

I looked at the OnLButtonDown and it does not care about multi-selection at all (and hence never calls SetSelectionCheck).

So, I think I just have to override (technically catch the notification) OnLButtonDown and tweak it to the SPACE BAR behavior when there are multiple selections, because I don't see any "settings" that would cause it to behave like the SPACE BAR event.


Posted By: franji1
Date Posted: 07 November 2014 at 4:42pm
Implemented my own OnLButtonDown() method that merges the VK_SPACE handling of the check box with the CXTCheckListBox::OnLButtonDown. Works great.

HOWEVER, double clicking on a check box (or more specifically checking/unchecking relatively quickly) causes CXTCheckListBox::OnLButtonDblClk to misbehave like CXTCheckListBox::OnLButtonDown. So I will need to "override" that message's behavior.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net