c++mfcselectabledisabled-inputccombobox

How do I disable a CComboBox while having it selectable for clipboard copy?


So first off, I have a CComboxBox that can only be obtained by GetDlgItem(cbID). This condition cannot be changed.

With this combobox, I can edit the text and show the dropdown items, but I want to disable those features.

I only know how to disable a Windows Object, for example...

GetDlgItem(cbID)->EnableWindow(FALSE);

But this disables both mouse and keyboard inputs, which doesn't allow me to highlight the text and copy it to a clipboard.

How would one disable a dropdown and editable feature while having it highlightable to copy to a clipboard?


Solution

  • The combo box style is probably CBS_DROPDOWN. If you cahge the style to CBS_DROPDOWNLIST you will remove the child edit control embedded within the combo box. That would prevent anyone from entering data.