Avatar of acicovic
acicovic
Flag for Greece asked on

Make CheckedListBox Item selectable only over check

Hi there,

I have a CheckedListBox with some items.  Currently, no matter where I click on an item, it gets selected.  What I want to do is make the item selected only when I click on its check.

Any way of doing that?

Thanks!
.NET ProgrammingC#

Avatar of undefined
Last Comment
acicovic

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike Tomlinson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
acicovic

ASKER
Hi Idle_Mind,

Thank you for your comment!  I'll try it later today or tomorrow and let you know how it worked out.

Thanks!
acicovic

ASKER
Hi there,

Works as advertised :)

There is only one thing that's not working as I expected, and this is probably due to the way I posed the question.  The code that you provided deselects all items when we click on an item outside the checkbox area.  In that case however, I wanted the item to get selected, but not checked.  

In other words, I want the functionality of a CheckedListBox with item selection on double click.  However, when we click directly on the checkbox it should be selected/deselected using only one click.

Given the code above though, I see how I would go about doing that provided I can cancel the MouseUp event.  Is there a way?  I've seen an e.Cancel property but it doesn't appear in this case.
Mike Tomlinson

Lol...ok.  Let's start over as I'm confused as to what it should do now...trying to make sense of the first set of requirements with the second set.  =\

Given a non-modified CheckedListBox, what different functionality do you want?  What needs to be removed/added?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
acicovic

ASKER
Hi there,

First of all, sorry for this...

It should behave exactly as the default CheckedListBox (CheckOnClick property set to False).  However, when we click directly on the CheckBox it should behave as if the CheckOnClick property was set to True.

Is this clearer?
acicovic

ASKER
Hi Idle_Mind,

Let me know if you plan on answering the "changed" question.  If not, I think I should still accept your first comment since it answered my question as I originally posed it.

Thanks...
Mike Tomlinson

Hi acicovic,

Sorry for the delay.  I just haven't gotten back to this question yet.  I'll play with it today...
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
acicovic

ASKER
ok, no problem.  It is not an emergency anyway, so you can take your time.