I have a CMFCTabCtrl
in my dialog and my CMFCTabCTrl
has two tabs.
The first tab has a CComboBox
and the second tab also has a CComboBox
.
Whatever item newly added in ComboBox in first tab will reflect in ComboBox in second tab. Similarly, whatever item newly added in ComboBox in second tab will reflect in ComboBox in first tab.
For this, I have all ComboBox items in a vector and in each dialog's WM_SETFOCUS
event I am adding items to ComboBox.
When user typing something in ComboBox but then user selects another control or dialog/tab also I am adding that item to ComboBox. For that I am tracking CBN_KILLFOCUS
in parent's dialog OnCommand
and adding the item to ComboBox.
Now my problem is when user type something in ComboBox and clicking on second tab, the SetFocus
of second tab is called first and then only OnCommand with CBN_KILLFOCUS()
message is getting called. So the second tab is not having newly added item by the first tab whereas the first tab is having that item.
How to make the ComboBox item available to the second tab before it is getting displayed.
If I do necessary operation(whatever operation I am doing on killfocus) on AFX_WM_CHANGING_ACTIVE_TAB, I am able to achieve my requirement.