End Google Ads 201810 - BS.net 01 --> Hello,

I am trying to use this control in a toolbar. For the most part the code works. However, I am running into this odd problem that I am getting partial text back when I call GetText.

The app requires that when I click a different button in the toolbar, I check the combo box and retrieve the text from it for processing. That is when this bug surfaces. The last character is getting truncated. If I retrieve the text in response to the Enter key handler for the combo box, I get the full text using the same GetText call.

Here is the code...most all of it is lifted from the samples.

CObList listButtons;
if (CMFCToolBar::GetCommandButtons(ID_EDT_FIND_NDC, listButtons) > 0)
{
for (POSITION posCombo = listButtons.GetHeadPosition();
pSrcCombo == NULL && posCombo != NULL; )
{
CMFCToolBarComboBoxButton* pCombo = DYNAMIC_DOWNCAST(CMFCToolBarComboBoxButton, listButtons.GetNext(posCombo));
if (pCombo != NULL) pSrcCombo = pCombo;
}
}

if (pSrcCombo != NULL)
{
ASSERT_VALID(pSrcCombo);

LPCTSTR lpszSelItem = pSrcCombo->GetText();
...
}

So if the combo box has the text '1234567890', I am getting back '123456789' in one case, and '1234567890' in another case, depending on whether I press the other button or press the Enter key.

Has anyone encountered this, and can someone suggest a solution?

Thanks for your time.