• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Valued Contributor
    Posts: 78
    Registered: ‎12-04-2009
    Accepted Solution

    Ribbon API Slide-Out

    170 Views, 5 Replies
    01-24-2013 02:03 PM

    Where are the bits of the Ribbon API to add a slide out to a ribbon panel?

     

               Autodesk.Windows.RibbonControl ribbonControl = Autodesk.Windows.ComponentManager.Ribbon;
                RibbonTab Tab = new RibbonTab();
    
                ribbonControl.Tabs.Add(Tab);
    
                // create Ribbon panels
                Autodesk.Windows.RibbonPanelSource panel1Panel = new RibbonPanelSource();
                panel1Panel.Title = "Panel1";
                RibbonPanel Panel1 = new RibbonPanel();
                Panel1.Source = panel1Panel;
                Tab.Panels.Add(Panel1);

     

    I saw some source that hinted you could use panel1Panel.AddSlideout() but in the search I do not see any Ribbon API that allows for any slideout functionality?

     

    Do you *have* to use the CUI API for this?

    Please use plain text.
    *Expert Elite*
    Posts: 3,115
    Registered: ‎07-22-2003

    Re: Ribbon API Slide-Out

    01-25-2013 06:23 AM in reply to: tonofsteel

    RibbonPanelBreak

     

    From the docs: 

    This class is used to organize a ribbon panel into main and slide-out panels.

    Add an object of this type to RibbonPanelSource.Items to move all the items after this item into the slide-out panel. There can be only one object of this type in RibbonPanelSource. If there are multiple RibbonPanelBreak objects in the same panel source, only the first one will be used.

    Jeff_M, also a frequent Swamper
    Please use plain text.
    Valued Contributor
    Posts: 78
    Registered: ‎12-04-2009

    Re: Ribbon API Slide-Out

    01-25-2013 07:57 AM in reply to: Jeff_M

    Thanks!

     

    Is there also a way to get the dialog launch arrow in the corner working?

     

    I found RibbonDialogBoxLauncher but this is in the Customization namespace associated with the cui dll.  Is there also a way to do this with the ribbon API and not the CUI API?

    Please use plain text.
    Valued Contributor
    Posts: 78
    Registered: ‎12-04-2009

    Re: Ribbon API Slide-Out

    01-25-2013 08:05 AM in reply to: tonofsteel

    I think I found it:

    RibbonCommandItem

     

    Create it and add it to RibbonPanelSource.  I am having trouble getting an image to show in it, must need a certain size and wont scale whatever you pass to it.

    Please use plain text.
    *Expert Elite*
    Posts: 3,115
    Registered: ‎07-22-2003

    Re: Ribbon API Slide-Out

    01-25-2013 09:37 AM in reply to: tonofsteel

    I ran into problems with this myself. Here's some sample code to show how it works.

        public class Class1
        {
            [CommandMethod("testmyRibbon", CommandFlags.Transparent)]
            public void Testme()
            {
                RibbonControl ribbon = ComponentManager.Ribbon;
                if (ribbon != null)
                {
                    RibbonTab rtab = ribbon.FindTab("TESTME");
                    if (rtab != null)
                    {
                        ribbon.Tabs.Remove(rtab);
                    }
                    rtab = new RibbonTab();
                    rtab.Title = "TEST  ME";
                    rtab.Id = "Testing";
                    //Add the Tab
                    ribbon.Tabs.Add(rtab);
                    addContent(rtab);
                    
                }
            }
    
            static void addContent(RibbonTab rtab)
            {
                rtab.Panels.Add(AddOnePanel());
            }
    
            static RibbonPanel AddOnePanel()
            {
                RibbonButton rb;
                RibbonPanelSource rps = new RibbonPanelSource();
                rps.Title = "Test One";
                RibbonPanel rp = new RibbonPanel();
                rp.Source = rps;
    
                //Create a Command Item that the Dialog Launcher can use,
                // for this test it is just a place holder.
                RibbonButton rci = new RibbonButton();
                rci.Name = "TestCommand";
    
                //assign the Command Item to the DialgLauncher which auto-enables
                // the little button at the lower right of a Panel
                rps.DialogLauncher = rci;
    
                
                rb = new RibbonButton();
                rb.Name = "Test Button";
                rb.ShowText = true;
                rb.Text = "Test Button";
                //Add the Button to the Tab
                rps.Items.Add(rb);
    
    
                return rp;
            }
        }

     

    Jeff_M, also a frequent Swamper
    Please use plain text.
    Valued Contributor
    Posts: 78
    Registered: ‎12-04-2009

    Re: Ribbon API Slide-Out

    01-25-2013 09:43 AM in reply to: tonofsteel

    Nice, thanks!  This did the trick.

    Please use plain text.