Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CXTCheckListBox check multi-select behavior
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTCheckListBox check multi-select behavior

 Post Reply Post Reply
Author
Message
franji1 View Drop Down
Groupie
Groupie
Avatar

Joined: 28 June 2005
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote franji1 Quote  Post ReplyReply Direct Link To This Post Topic: CXTCheckListBox check multi-select behavior
    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).

Back to Top
franji1 View Drop Down
Groupie
Groupie
Avatar

Joined: 28 June 2005
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote franji1 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
franji1 View Drop Down
Groupie
Groupie
Avatar

Joined: 28 June 2005
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote franji1 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.145 seconds.