I have this code:
void CChristianLifeMinistryEditorDlg::UpdateDatesCombo()
{
for (int iDate = 0; iDate < m_cbDates.GetCount(); iDate++)
{
auto *pEntry = (CChristianLifeMinistryEntry*)m_cbDates.GetItemDataPtr(iDate);
if (pEntry != nullptr)
{
COMBOBOXEXITEM cmbItem;
CString strDateOriginal = _T("");
CString strDateNew = FormatWeekOfMeetingText(pEntry->GetMeetingDate());
// Get the existing item from the combo
cmbItem.mask = CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_TEXT | CBEIF_LPARAM;
cmbItem.iItem = iDate;
cmbItem.pszText = strDateOriginal.GetBuffer(_MAX_PATH);
cmbItem.cchTextMax = _MAX_PATH;
m_cbDates.GetItem(&cmbItem);
strDateOriginal.ReleaseBuffer();
// Update the text
strDateNew = FormatWeekOfMeetingText(pEntry->GetMeetingDate());
cmbItem.pszText = strDateNew.GetBuffer(_MAX_PATH);
m_cbDates.SetItem(&cmbItem);
strDateNew.ReleaseBuffer();
}
}
}
It works fine and correctly changes the drop list from one language to another.
However, the existing value in the combo is not updated until I hover the mouse over the control.
I have tried m_cbDates.UpdateWindow
and it makes no difference.
I saw this question but my issue relates to the text and not the image.
How do I get the CComboBoxEx
to force it to show the updated text value?