MFC MDI Change tab styles after Addview is completed via Property Sheet
-
I am using a property sheet for my app to adjust the options and GUI elements. When the file opens, the app has two tabs created via `Addview` and all of that is working. `OnInitialUpdate` sets the styles because it uses the registry settings when it starts. What I'm trying to do is have the styles adjust on an `OnApply` when the user selects the style they want. I have the `OutputPane` working correctly which is shown in the code below. What I can't get to work is to have the document tabs change on a `Recalc/Redraw`. ``` BOOL CSettingsUserTabs::OnApply() { BOOL bResult = CMFCPropertyPage::OnApply(); if (bResult) { // Update Output Pane Tab Styles (100% Working) AfxGetApp()->WriteProfileInt(_T("Settings"), _T("UserTabStyle"), m_style_tabs); // Save value to registry ((CMainFrame*)AfxGetMainWnd())->m_wndOutput.m_wndTabs.ModifyTabStyle((CMFCTabCtrl::Style)m_style_tabs); ((CMainFrame*)AfxGetMainWnd())->m_wndOutput.m_wndTabs.RecalcLayout(); // Update MDI tab styles (Not working) CMFCTabCtrl& MDI_STYLES = ((CMainFrame*)AfxGetMainWnd())->GetMDITabs(); MDI_STYLES.ModifyTabStyle((CMFCTabCtrl::Style)m_style_tabs); MDI_STYLES.RecalcLayout(); CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWndEx, GetTopLevelFrame()); pMainFrame->SetFocus(); pMainFrame->RecalcLayout(); } return bResult; } ``` Any ideas what I can do solve this problem? I've scoured the net for examples on how to solve this issue and yet to get it to work. There is a `TabControl` solution in the Microsoft master repository to show how it works, but since I'm using a `propertysheet` to control it, the example does work but the example doesn't use the `AddView` so I can't use it as a good example. Here is the code that loads the `RUNTIME_CLASSES` where the tabs are created: ``` void CMovieView::OnInitialUpdate() { // add views to program AddView(RUNTIME_CLASS(CTabView1), AfxStringID(IDS_TAB1)); AddView(RUNTIME_CLASS(CTabView2), AfxStringID(IDS_TAB2)); GetTabControl().EnableTabSwap(TRUE); GetTabControl().SetLocation(CMFCBaseTabCtrl::Location::LOCATION_TOP); GetTabControl().EnableAutoColor(TRUE); // Modify User Define tab style: int UserTabStyle = AfxGetApp()->GetProfileInt(_T("Settings"), _T("UserTabStyle"), 0); //Get value from registry // If the key doesn't exist, UserTableStyle will be 0 or FALSE; if (UserTabStyle != FALSE && UserTabStyle <= 8) { // User selected tab st