CLR Extender Reference
Ribbon Sample
Description »
This sample uses the Ribbon Control from José Menéndez available here. While the Ribbon Control is available in C# you can compile it easily using the VFP Developer Studio.
Here is the screenshot of the first tab of the Ribbon in a VFP Form:

And here is the second tab:

The Control model follows as :
- A ribbon is composed by several RibbonTabs. Each tab is a RibbonTab. You add a tab by using oRibbon.Tabs.add(oTab)
- A RibbonTab is integrated by several panels. Each panel is a RibbonPanel. You add a panel by using oTab.Panels.Add(oPanel)
- In each Panel you put the desired RibbonButton, RibbonTextBox.RibbonButtonList, RibbonButtonSeparator.
The first tab show a Paste a RibbonButton with some items inside it is created in the InitControl method. Below is the expanded version when clicked in the arrow:

Example »
LOCAL oTab,oButton, oItem
* Tab home
oTab = CLRCreateObject("System::Windows::forms::RibbonTab")
oTab.Text = "Home"
* Creating first panel
oPanel = CLRCreateObject("system::windows::forms::RibbonPanel")
oPanel.Text = "Clipboard"
oPanel.ButtonMoreEnabled = .F.
* Creating button paste
oButton = CLRCreateObject("system::windows::forms::RibbonButton")
oButton.Text = "Paste"
oButton.Image = THISFORM.GetImage("Paste16.gif")
oButton.Style = RibbonButtonStyle_SplitDropDown
* Adds button to panel
oPanel.Items.Add(oButton)
* And now adds the panel to the tab
oTab.Panels.Add(oPanel)
******** Add the first tab *********
THIS.Tabs.Add(oTab)
Remarks »
The most important code is in the InitControl method of the netRibboncontrol control. See the form.
Send
comments about this topic to eTecnologia.net.