.NET

Reply
Valued Contributor
tonofsteel
Posts: 93
Registered: ‎12-04-2009
Message 1 of 6 (418 Views)
Accepted Solution

Ribbon API Slide-Out

418 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?

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.

*Expert Elite*
Jeff_M
Posts: 4,385
Registered: ‎07-22-2003
Message 2 of 6 (399 Views)

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
Valued Contributor
tonofsteel
Posts: 93
Registered: ‎12-04-2009
Message 3 of 6 (391 Views)

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?

Valued Contributor
tonofsteel
Posts: 93
Registered: ‎12-04-2009
Message 4 of 6 (390 Views)

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.

*Expert Elite*
Jeff_M
Posts: 4,385
Registered: ‎07-22-2003
Message 5 of 6 (382 Views)

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
Valued Contributor
tonofsteel
Posts: 93
Registered: ‎12-04-2009
Message 6 of 6 (379 Views)

Re: Ribbon API Slide-Out

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

Nice, thanks!  This did the trick.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.