Overriding CComboBox functionality...

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: BRM (BRM_at_discussions.microsoft.com)
Date: 08/17/04


Date: Tue, 17 Aug 2004 07:03:02 -0700

I gave up trying to do what I last posted, and simply sub-classed the combo
box to do it; annoying but it works. (Why did MS not build in that
functionality in the first place?! Especially since so many people are doing
what I just did to do it. Any how...)

I want to keep the text of the edit control from changing when the user
selects an item. I can get the old text just fine by overriding the
functionality of the CBN_SELCHANGE handler.

If I am reading the docs correctly, I should be able to update the text back
to the old text by overriding the CBN_EDITCHANGE handler, or do something
with the CBN_EDITUPDATE handler. However, the handlers never seem to be
called, and the text gets updated to the selection, not what I want it to be.

(For kicks, I also tried doing the m_Edit.SetWindowText(OldText) in the
CBN_SELCHANGE handler. That (expectedly) did not work either.)

I simply want to be able to keep the text the same even if the user selects
something. How can I do this?

TIA,

BRM


Quantcast