Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
485
How to programmatically add existing button to a toolbar
posted

I have a CAB application that uses multiple toolbars. Sometimes I want to add a button to the current toolbar. The button already exists so I do not need to programmatically create it but I do need to explicitly add it to whatever toolbar the current CAB view is about to display. How can this be done?

Parents
No Data
Reply
  • 485
    Verified Answer
    posted

    Nevermind. I figured it out. It looks like the toolbar itself, given either a numerical index or a string key, knows how to get the button from the owning toolbar manager's collection of Tools so all that is needed is to pass a key to the toolbar and tell it to add the associated button.

    Theoretical example:

    UltraToolbar tb = m_ToolbarMgr.Toolbars[strTbKey];
    tb.Tools.AddTool(strButtonKey);
    
Children
No Data