Adrian
Adrian

Reputation: 20068

Disable items in a CheckedListBox in 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?

Upvotes: 3

Views: 1266

Answers (1)

AJG85
AJG85

Reputation: 16197

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.

Upvotes: 3

Related Questions