Ribbon Bar

Starting from the PPJ Framework 2009 release we have added a new RibbonBar component. The Ribbon has been fully integrated in the PPJ Framework and can be added to existing regular Forms and MDI Forms.

However, using the Ribbon from the developers perspective requires more than simply using the SalRibbonBar classes in the PPJ Framework. The Ribbon control is a complex component with many features and is not a mere replacement of the window's menu.

The RibbonBar component that we have licensed includes an advanced visual designer that allows you to fully design your ribbon to any level of complexity.

Using the Ribbon

There are two ways to use the integrated Ribbon control with the migrated applications. One is to change the base class of the applications' forms, the second is to create a new Ribbon form and embed the existing forms in the client area of the new Ribbon form.

We have added three new classes to the PPJ Framework:

  • SalRibbonBarMDI

  • SalRibbonBarForm

  • SalRibbonStatusBar

The only two classes that should be used directly are SalRibbonBarMDI and SalRibbonBarForm. An instance of SalRibbonStatusBar named "StatusBar" is already included in both classes.

To add the Ribbon Bar to an existing migrated application is as easy as changing the base class name of the main form or to create a new Ribbon form and select the main form to be embedded in client area.

Changing the base class name

Using this approach you have to replace SalFormWindow with SalRibbonBarForm and SalMDIWindow with SalRibbonMDI.

In case your existing forms already contain an instance of SalFormStatusBar named "StatusBar" you have to delete it from everywhere otherwise it will collide with the existing SalRibbonStatusBar already created in the base SalRibbonBarForm class.

After the base class name is changed and the application compiles without errors you can open the form in design mode and start working with the ribbon control.

If you call code that uses Sys.hWndForm from the new event handlers generated by the Ribbon Bar (or from any new event handler) do not forget to update the Sys.hWnd* variables using the SalContext class.

Create a new SalRibbonForm form

The second way to use the Ribbon component is to create a new form of type SalRibbonBarForm and select the existing main form to be embedded in the new form's client area.

We have added a property named "ChildForm" with a custom editor which allows Visual Studio to show a list of form types that can be selected.

When the new SalRibbonBarForm is created, it will automatically create and embedded the selected main form.

Using this technique has the added advantage that it doesn't require changes to the embedded form and it keeps all the complexities of the ribbon bar design in a separate form.

Working with events

When creating and wiring the new events from the Ribbon's components you have to be careful to add the SalContext switcher class when the code (or called code) needs to refer to the Sys.hWndForm system variables.

Ribbon Designer

The Ribbon Bar component that is included in the PPJ Framework release comes with a built-in powerful designer. Using the ribbon designer you can create and personalize complex ribbon controls with very little limitations.

Using the Ribbon that we have integrated in the PPJ Framework 2009 you can achieve just about anything. Even recreate the complex Microsoft Word Ribbon Bar.

The screen image below shows one of the demo Team Developer applications ported to C# and modernized with the new Ribbon Bar control.

Ribbon Bar and Skinning

Microsoft guidelines for the Ribbon Bar allow for 3 themes: Office 2007 Blue, Office 2007 Black and Office 2007 Silver.

We have added the three Office 2007 skins as embedded resources in the PPJ Framework in order to skin all the controls in the forms that are "ribbon enabled".

When the skin of the Ribbon Bar is changed, the PPJ Framework selects and applies the corresponding skin to the form.

Last updated