When I have a SDI Document-View MFC application which uses CBCGPTabView
as the main view, one of the tabs is a CEditView
. If I send a custom message to the CBCGPTabView
derived class and use GetTabControl().SetTabLabel()
it not only changes the tab label but contents of the CEditView
. Is there a way to prevent that?
Asked
Active
Viewed 61 times
0

animuson
- 53,861
- 28
- 137
- 147

user3161924
- 1,849
- 18
- 33
-
What's the value of your custom message? – IInspectable Jul 02 '21 at 16:02
-
based on WM_APP – user3161924 Jul 02 '21 at 21:47
2 Answers
0
This is the workaround I have for now:
// hack to work around ceditview getting its window contents changed
CView* pview=GetView(tabi);
if (pview->IsKindOf(RUNTIME_CLASS(CEditView))) {
CString strexistingtext;
pview->GetWindowText(strexistingtext);
// change label
tabctrl.SetTabLabel(tabi, strlabel);
// put back text
pview->SetWindowText(strexistingtext);
}
else {
// change label
tabctrl.SetTabLabel(tabi, strlabel);
}
}

user3161924
- 1,849
- 18
- 33
0
Another method is to override
virtual CString CBCGPMDIChildWnd::GetFrameText() const
And put / set there what you need.

Flaviu_
- 1,285
- 17
- 33