Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » Add Group with Code Collapse All
Subject Author Date
Gunter Avenius Oct 21, 2007 - 1:44 PM

Hello,

Elegant Ribbon (Vers. 2.1):

how can i add a Group in the current tab with Code (VB2005)?

Thanks

Gunter Avenius Oct 23, 2007 - 3:09 AM

Hello,

I have solved my problem

Thanks

Best Regards
Gunter

Gunter Avenius Oct 22, 2007 - 12:42 PM

Hello,

thanks for your sample.

ok. the Ribbon is build with tabs (2) and groups (2) (2)

So, i want to add Controls (buttons, or other) to the group with the Name(Ribbon Group 1.2) or i want change the name "Ribbon Group 1.2" in an other Text.

Or I want to delete the group with the Text "Ribbon Group 2.1"

Best regards
Gunter

Gunter Avenius Oct 22, 2007 - 10:41 AM

Hello,

I create Tabs and Groups via Code.

Sample (2 Tabs with 4 Groups)

To change the Text of Tabs or add Groups are no problem (CurrentTabPage).

But, how can i change a Group Text without to now what is the Current Group or the selected Group. Or. add Controls to the selected / Current Group.

Sorry for my bad english.

Best regards
Gunter

Technical Support Oct 22, 2007 - 12:13 PM

It is not completely clear what you mean by the Current Group but, if you want to populate the ribbon programmatically, you could use the following code

Dim tabPage As RibbonTabPage = New RibbonTabPage()
tabPage.Text = "Page 1"

Dim ribbonGroup As RibbonGroup = New RibbonGroup()
ribbonGroup.Text = "Ribbon Group 1.1"

tabPage.Controls.Add(ribbonGroup)

ribbonGroup = New RibbonGroup()
ribbonGroup.Text = "Ribbon Group 1.2"

tabPage.Controls.Add(ribbonGroup)

ribbon1.TabPages.Add(tabPage)

tabPage = New RibbonTabPage()
tabPage.Text = "Page 2"

ribbonGroup = New RibbonGroup()
ribbonGroup.Text = "Ribbon Group 2.1"

tabPage.Controls.Add(ribbonGroup)

ribbonGroup = New RibbonGroup()
ribbonGroup.Text = "Ribbon Group 2.2"

tabPage.Controls.Add(ribbonGroup)

ribbon1.TabPages.Add(tabPage)

Technical Support Oct 22, 2007 - 10:31 AM

Here is the code

    Dim currentTabPage As RibbonTabPage = ribbon1.CurrentTabPage

       If Not currentTabPage Is Nothing Then
              For Each ribbonGroup As RibbonGroup In currentTabPage.Controls
                     ’...
              Next ribbonGroup
       End If
If it is not what you are looking for, please let us know.

Gunter Avenius Oct 22, 2007 - 10:11 AM

Hello,

Thanks for your reply.

Have you a little code sample ?

Best regards
Gunter

Technical Support Oct 22, 2007 - 10:02 AM

Actually there is no such thing as "current group” in the ribbon. If you need to enumerate ribbon groups within a tab page, you can use the RibbonTabPage.Controls collection.

Gunter Avenius Oct 22, 2007 - 9:54 AM

Hello,

i get the Current Tab with "ribbon1.CurrentTabPage"

how can i get the Current Group?

Thanks

Gunter Avenius Oct 22, 2007 - 9:36 AM

Thanks!

Great support.

Best regards
Gunter

Technical Support Oct 22, 2007 - 8:29 AM

You can use the following code for that

Dim ribbonGroup As RibbonGroup = New RibbonGroup()
Dim currentTabPage As RibbonTabPage = ribbon1.CurrentTabPage
If Not currentTabPage Is Nothing Then
      currentTabPage.Controls.Add(ribbonGroup)
End If