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
S

S T K

@S T K
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Adding a new button to and existing CMFCRibbonBar "tab"
    S S T K

    Here is a link to a visual studio project which demonstrates my issue. If anyone can explain why the clicking of the button on the ribbon generates a new menu entry which does not get acted upon I would be very grateful. https://onedrive.live.com/redir?resid=96603E24528956FC!133&authkey=!AAopnvy2aTNr1tY&ithint=file%2czip[^] Thanks Steve.

    C / C++ / MFC c++ help tutorial lounge learning

  • Adding a new button to and existing CMFCRibbonBar "tab"
    S S T K

    Can anyone help me? I am still unable to add to a ribbonbar “tab”. Here is an example bit of code, which when added to a new MFC MDI basing ribbon example generated from the wizard works correctly until I add the bit at the bottom. Add to MainFrm.h

    // Implementation
    public:
    void CMainFrame::CreateAddtoTabs();
    void CMainFrame::AddToExistingTab();
    void CMainFrame::DoIWork(UINT ID);
    public:
    CMFCRibbonButton *pQuickMenu;
    CMFCRibbonBar m_wndRibbonBar;

    Add to MainFrm.cpp

    BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
    ON_COMMAND(2000,&CMainFrame::AddToExistingTab)
    ON_COMMAND_RANGE(1000,1001,&CMainFrame::DoIWork)
    END_MESSAGE_MAP()

    //Replace the existing InitializeRibbon routine.

    void CMainFrame::InitializeRibbon()
    {
    BOOL bNameValid;

    CString strTemp;
    bNameValid = strTemp.LoadString(IDS\_RIBBON\_FILE);
    ASSERT(bNameValid);
    
    // Load panel images:
    m\_PanelImages.SetImageSize(CSize(16, 16));
    m\_PanelImages.Load(IDB\_BUTTONS);
    
    // Init main button:
    m\_MainButton.SetImage(IDB\_MAIN);
    m\_MainButton.SetText(\_T("\\nf"));
    m\_MainButton.SetToolTipText(strTemp);
    
    m\_wndRibbonBar.SetApplicationButton(&m\_MainButton, CSize (45, 45));
    CMFCRibbonMainPanel\* pMainPanel = m\_wndRibbonBar.AddMainCategory(strTemp, IDB\_FILESMALL, IDB\_FILELARGE);
    
    CreateAddtoTabs();
    

    }

    //Include new routines in MainFrm.cpp

    void CMainFrame::CreateAddtoTabs()
    {
    pQuickMenu = new CMFCRibbonButton(1000,TEXT("QuickMenu"),NULL,0,0,0,0);
    AddToExistingTab();
    m_wndRibbonBar.AddToTabs(pQuickMenu);
    }

    void CMainFrame::AddToExistingTab()
    {
    pQuickMenu->AddSubItem(new CMFCRibbonButton(1001,TEXT("Do I work?"),NULL,0,0,0,0),-1);
    }
    void CMainFrame::DoIWork(UINT ID)
    {
    MessageBox(TEXT ("Yes I Do!"),TEXT("Do I Work?"), MB_ICONWARNING) ;
    }

    If I add the above strucutre to a ribbon based MDI MFC application, a new “QuicMenu” tab appears on the menu system. It works. If I click the “Do I work?” menu entry then it pops up a panel saying “yes I do!” If I now add a button to the ribbonbar at time of initialisation, which when clicked will adds a new button to the “QuickMenu” menu then all is good. The additional button turns up and is selectable.

    void CMainFrame::InitializeRibbon()
    …
    …
    …
    …

    CMFCRibbonCategory \*pCat = m\_wndRibbonBar.AddCategory(TEXT("Update AddToTabs"),0,0,CSize(16,16),CSize(32,32
    
    C / C++ / MFC c++ help tutorial lounge learning

  • Floating point conversion
    S S T K

    I am not seeing this issue. I get 4 for unResult. Do you have your floating point options set correctly in the compiler? In visual studio, select properties on your C project. Expand the projects setting out for "c/C++->Code Generation" and set the option for "Floating Point Model" to Precise(/fp:precise).

    C / C++ / MFC help

  • Adding a new button to and existing CMFCRibbonBar "tab"
    S S T K

    I now have a simple MFC example which demonstrates my issue. Is it possible for me to upload this somewhere hoping that someone can pinpoint where I’ve gone wrong and help correct it. Thanks. Steve.

    C / C++ / MFC c++ help tutorial lounge learning

  • Adding a new button to and existing CMFCRibbonBar "tab"
    S S T K

    I have a large legacy application being updated to use newer CMFCRibbonBar. This application is large and the creation of the CMFCRibbonBar involves converting a lot of legacy icons and menu structures so is a bit complicated to extract and post here. I will add further details as people request them. But the general gist is: The application works fine and has a valid and working CMFCRibbonBar. That ribbon bar has 11 categories across the top. With hundreds of panel buttons and menu buttons. I have also recreated the same structure using CMFCRibbonButton to create a quick old style menu system which has been added to the m_wndRibbonBar via the AddToTabs. This give me a working drop down menu in the top right had corner. I believe there is a general web example which people may be familiar with which create a “window style” dropdown where you to change the MFC window manager style from windows 2000 through to windows7. My menu is created from scratch at application startup and is not taken from a menu resource as this application predates this structure. I use commands like the following to construct this menu: pQuickMenu = new CMFCRibbonButton(ID_MENU++,TEXT("Quick Menu"),-1,-1,0); … pQuickButton = new CMFCRibbonButton(ID_MENU++,wMenuCommand,-1,-1,0); pQuickMenu->AddSubItem(pQuickButton,-1); … … m_wndRibbonBar.AddToTabs(pQuickMenu); The problem I am having is dynamically adding new buttons to this quick menu at a later date. When I originally created this quick menu I kept the pointer to this structure that was used to add to the ribbon. Therefore I am able to add to the quickmenu. pQuickBut = new CMFCRibbonButton(ID_MENU,wMenuCommand,NULL,0,hSmall,0,0); pQuickMenu->AddSubItem(pQuickBut,ilp); If I add a new button to the existing stored top level quick menu using the stored pQuickMenu pointer, the button does appear. The text is correct and the button is selectable. Except that the button is not operated upon when clicked. If I add the button to the m_wndRibbonBar instead then it works so I know there is a valid command handler. Down within the MFC code, clicking on my new quick access menu enters a routine called: CMFCRibbonBaseElement::NotifyCommand(BOOL bWithDelay) This extracts the command id correctly. UINT uiID = GetNotifyID(); But it then checks for a valid ribbonbar. CMFCRibbonBar* pRibbonBar = GetTopLevelRibbonBar(); This fails and returns a null pointer. Thus the command processing structure is exited. As a test, if I call m_wndRibbonBar.AddToTabs(pQuickMenu) aga

    C / C++ / MFC c++ help tutorial lounge learning
  • Login

  • Don't have an account? Register

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