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
K

kittmaster

@kittmaster
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Switching a toolbar from Docked to Floating without restarting app?
    K kittmaster

    I found that via the class I was looking at and reading the class methods when we were looking at the rectangle offsets. I read it as it would recalc the rectangles of the toolbar and plant it, clearly I was incorrect as my result are as you mentioned...not working. I will look at the code samples you linked to. Thank you, Chris

    C / C++ / MFC help question c++ testing debugging

  • Switching a toolbar from Docked to Floating without restarting app?
    K kittmaster

    I added this line of code after the difference calculation:

    AdjustWindowRectEx(&rect, m_wndToolBar.GetStyle(), FALSE, m_wndToolBar.GetExStyle());

    It zeroed out the values but the same ghost blocks still remain. I can't find direct access to that variable you mentioned, any code example/tips you could point me to? Thanks, Chris

    C / C++ / MFC help question c++ testing debugging

  • Switching a toolbar from Docked to Floating without restarting app?
    K kittmaster

    Hi David, Thanks for responding. I have added the code and executed it, you can see there is a difference result in the image: [http://kittmaster.com/imagedump/codeproject/Toolbar-Difference.png\](http://kittmaster.com/imagedump/codeproject/Toolbar-Difference.png) I'll look to see how to send the ``WM_NCCALCSIZE`` as I've never had to work with this aspect before. Hopefully this will help sort it out!

    C / C++ / MFC help question c++ testing debugging

  • Switching a toolbar from Docked to Floating without restarting app?
    K kittmaster

    So my app works using MFC toolbar creation without issue. If I set a flag, I can make it Dock or Float when the program is started using ``m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);``. The code that does it lives in the ``OnCreate`` which of course can only be called once. What I'm looking to do is use my property sheet to allow the user to select the mode of the toolbars ``Docked`` or ``Floating`` which requires a method outside of the ``OnCreate``. So I have two buttons for testing, one to destroy the ``toolbar`` (working) and create which "rebuilds" the toolbar.... I start off with the app in the ``Docked`` mode, then I test by destroying the toolbar and then rebuilding it. The rebuild is where my issue is. On the ``rebuild``, it is "adding" some blank space equivalent to the two toolbars (``Menu`` and ``Button``) and the toolbars ``float``....I can drag it out of where it was docked.....and the floating bar works.....but it "leaves behind" the a non functional version of the ``floating`` toolbar where it was once docked. If I double click the floating bar, it jumps back to its previously docked location. So I'm trying to figure out what is needed to correct my code that partially does what I want.....and fix the artifacts. The code to destroy:

    int CMainFrame::OnToolBarDestroy()
    {

    //if (!m\_wndToolBar)
    //{
    //	m\_wndOutput.AddStringStatusTab(\_T("Error: Icon toolbar is already removed, action cancelled"));
    //	m\_wndOutput.AddStringDebugTab(\_T("Debug: MainFrame--Error: Icon toolbar is already removed, action cancelled"));
    //	return -1;
    //}
    
    //m\_wndToolBar.Invalidate();
    //m\_wndMenuBar.DestroyWindow();
    //m\_wndToolBar.DestroyWindow();
    //m\_wndToolBar.AdjustDockingLayout();
    //RecalcLayout();
    //OnToolBarCreate();
    
    //return 0;
    
    //CRect rcClientOld;
    //CRect rcClientNew;
    //GetClientRect(rcClientOld);
    //RepositionBars(AFX\_IDW\_CONTROLBAR\_FIRST, AFX\_IDW\_CONTROLBAR\_LAST, 0, reposQuery, rcClientNew);
    
    //m\_wndToolBar.ShowPane(FALSE, FALSE, TRUE); // Hide toolbar
    //RecalcLayout();
    
    CDockingManager myPane;
    myPane.RemovePaneFromDockManager(&m\_wndToolBar, TRUE, TRUE, TRUE, NULL);
    m\_wndToolBar.Invalidate();
    m\_wndToolBar.DestroyWindow();
    
    myPane.SaveState();
    
    CPaneContainer myContainer;
    myContainer.RemoveNonValidPanes();
    
    RecalcLayout();
    
    return 0;
    

    }

    The code to rebuild the toolbar:

    int CMainFrame::OnToolBarCreate()
    {
    if (m_wndToolBar)
    {
    m_wndOutput.AddStringStatusTab(_T("Error: Icon toolbar is al

    C / C++ / MFC help question c++ testing debugging

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

    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

    C / C++ / MFC help tutorial c++ wpf windows-admin
  • Login

  • Don't have an account? Register

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