.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ribbon API Slide-Out

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
drauckman
2076 Views, 5 Replies

Ribbon API Slide-Out

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?

5 REPLIES 5
Message 2 of 6
Jeff_M
in reply to: drauckman

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
EESignature
Message 3 of 6
drauckman
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?

Message 4 of 6
drauckman
in reply to: drauckman

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.

Message 5 of 6
Jeff_M
in reply to: drauckman

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
EESignature
Message 6 of 6
drauckman
in reply to: drauckman

Nice, thanks!  This did the trick.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost