Design and create a RibbonBar
As the first step, you shall design the RibbonBar, that is,
deciding what items to contain in the RibbonBar, what modern-looking
image to use for each item, and how to group the items, etc.
Once you know clearly how you want the RibbonBar to look like,
you can start to create it. We recommend you use the RibbonBar Builder
tool to create the RibbonBar XML/JSON file. Alternatively, you can
choose to directly create a RibbonBar via PowerScript.
For PowerScript functions that can be used to create a
RibbonBar, refer to PowerBuilder Help > RibbonBar control. In the
demo application, for better illustration purpose, you will see both
the XML file and PowerScript code are provided for creating the
RibbonBar. When the application initiates the RibbonBar, it uses an
argument in the wf_init_ribbonbar function to decide which way (XML or
PowerScript) to use for creating the RibbonBar (see Initiate the
RibbonBar).
Creating the XML for the RibbonBar in this
demo (Recommended):
A dedicated tool, RibbonBar Builder, is available in
PowerBuilder to assist you to create the RibbonBar XML (or JSON). In
the tool, you can use a template (RibbonBar.xml) to create your own
XML, and preview the RibbonBar UI while you work. This is the
recommended approach.
In the demo application:
-
Open Tools > RibbonBar Builder in PowerBuilder IDE, and
open and edit the file created for the RibbonBar:
SalesApplicationDemo_RibbonBar.xml.
Creating the PowerScript for the RibbonBar
in this demo:
In the demo application:
-
Open the function w_mdi.wf_init_ribbonbar, and you will see
the PowerScript for the RibbonBar in the function. The script is
different from XML, but shall still be easy to understand.For example, the following script inserts File as a
RibbonBar category, adds an orderview panel in this category, and
then adds buttons inside the panel.123456789101112//File menulong ll_handle, ll_category, ll_panel, ll_groupRibbonSmallButtonItem lrs_itemRibbonmenu lrm_menuribbonLargeButtonItem lrl_itemribbongroupitem lrg_itemlong ll_return, ll_tmp, ll_tmp2ll_category = arbb.insertcategoryfirst ("File") //Insert a category//orderviewll_panel = arbb.insertpanellast (ll_category, "OrderView", "orderview.png") //Insert a panelarbb.insertLargebuttonlast (ll_panel, "Orders", "orderview.png", "ue_orderview") //Insert buttonarbb.insertLargebuttonLast (ll_panel, "Print", "printbig.png", "ue_orderview_print")