Select a RibbonTab programmatically

May 3, 2013 at 3:53 PM
How can i Select a RibbonTab?

Similar to a tabpage with tabcontrol1.SelectedIndex = 1?

Thanks,
Developer
May 4, 2013 at 5:29 PM
The Ribbon has a property ActiveTab.
Pseudo-code:
foreach (RibbonTab t in ribbon1.Tabs)
{
  if (t.Text == "ASDF")
  {
    ribbon1.ActiveTab = t;
    break;
  }
}
May 13, 2013 at 5:12 PM
good Day toAtWork,
how do i implement something like this:
private void ControlsToPermissions()
    {
        foreach (RibbonTab tb in ribbon1.Tabs) //i want to remove all the controls
        {
            tb.Visible = false;

            foreach (RibbonGroup grp in tb.Groups)
            {
                grp.Visible = false;
                int count = grp.Items.Count;
                for (int i = 0; i < count; i++)
                {
                    grp.Items[i].Visible = false;
                }
            }
        }

        foreach (GMSItemMenu menu in Permissions)  //now make the visible
        {
            if (menu.IsMenuParent)      //tabs
            {
                ribbon1.Tabs[menu.MenuName].Visible = true;
            }
            else        //commandbuttons
            {
                foreach (RibbonTab tb in ribbon1.Tabs)
                {
                    foreach (RibbonGroup grp in tb.Groups)
                    {
                        if (grp.Item.Contains(menu.MenuName))
                            grp.Item[menu.MenuName].Visible = true;
                    }
                }
            }

        }

        foreach (RibbonTab tab in ribbon1.Tabs)
        {
            foreach (RibbonGroup grp in tab.Groups)
            {
                int count = grp.item.Count;
                bool mvisibl= false;
                for (int i = 0; i < count; i++)
                {
                    mvisibl= grp.item[i].Visible;
                    if (mvisibl)
                    {
                        grp.Visible = true;
                        break;
                    }
                }


            }
        }
    }
i am trying to have a collection of all controls on the ribbon and put them in a database so that i can implement control based security

thanks in advance
Developer
May 14, 2013 at 6:59 AM
lsvosve:
Please post only in a single discussion. For a new discussion, create a new discussion (as you already did).
I will give you some advise there:
https://officeribbon.codeplex.com/discussions/443554
Maybe you can edit this post and write something that you created an own discussion...
Thanks