Small Fix for Checkbox reappearing in front of installed items

Jul 24, 2009 at 11:58 PM
Edited Jul 25, 2009 at 9:44 AM

Hi,

I notices that the checkbox of an installed item reappears if one changes the state of a non-required checkbox. If a I (un)checked such an item, an unchecked checkbox appeared before installed items.
The problem was (I think) that if one (un)checked an item, the CComponentsList gots redrawn but somehow void CComponentsList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) was not called by this redrawing. This is strange, since you override it - who knows.

I corrected this behaviour by adding the following protected method to ComponentsList.h:
void OnCheckChange();

and the following implemantation and an entry to the MFC message map to ComponentsList.cpp:
BEGIN_MESSAGE_MAP(CComponentsList, CCheckListBox) 
  ON_CONTROL_REFLECT(CLBN_CHKCHANGE, OnCheckChange)
END_MESSAGE_MAP()

void CComponentsList::OnCheckChange()
{
 this->Invalidate();
}


I don't know if this is useful to you, but it helped me to not see this strange unchecked checkbox in front of installed items :). This works at least on Vista and XP - I have currently no other systems to test against.

Regards,
Tom

Edit: Fixed typo

Coordinator
Jul 25, 2009 at 2:57 AM

Cool. I'll run some quick tests and commit this change, thank you. Maybe you can fix the download dialog crash? :)