Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC MDI Change tab styles after Addview is completed via Property Sheet

MFC MDI Change tab styles after Addview is completed via Property Sheet

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialc++wpfwindows-admin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kittmaster
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups