Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable items in a CheckedListBox in MFC

Tags:

c++

mfc

Does CheckedListBox::Enable() to enable/disable items should behave like GetDlgItem(checkedbox)->EnableWindow(False), for a simple checkedbox, I mean for the last one, the item has the aspect of a disabled item, but for checkedlistbox the item has a normal aspect but I can't select it.

So is this normal for disable items from a CheckedListBox to not have a gray aspect?

like image 706
Adrian Avatar asked Mar 10 '26 16:03

Adrian


1 Answers

Try to avoid using GetDlgItem

CCheckedListBox::Enable() is used to enable and disabled the individual checkbox in the list based on the index you pass into it.

EnableWindow is intended to enable or disable the entire control. In the case of a checkbox I would expect these to be similar however the CCheckedListBox may handle how it manages it's check box list items differently than how an independent checkbox control would behave.

You can probably override DrawItem and use owner drawn style if you want to do something different than the default behavior when updating visual aspects.

like image 124
AJG85 Avatar answered Mar 12 '26 05:03

AJG85



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!