1

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?

Vongdarakia
  • 379
  • 1
  • 12
  • 25

1 Answers1

1

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.

rrirower
  • 4,338
  • 4
  • 27
  • 45
  • Thanks, that's a good idea for disabling the keyboard input, but I also do not want to have the dropdown feature, which will still be there. – Vongdarakia Jan 23 '14 at 17:00
  • There are a few ways to handle that piece. You can trap [CBN_DROPDOWN](http://forums.codeguru.com/showthread.php?444622-How-to-prevent-combo-box-list-appear-when-catching-the-CBN_DROPDOWN-msg&p=1677568#post1677568), or, the button down event on the control. If you decide on the latter, make sure not to call the base class. That should short circuit the call to drop the list down. – rrirower Jan 23 '14 at 17:35