<view/>

Description

The view element is used to specify details of the view. These include the view title, backing unit for the view and init function that should be called when the view is loaded. Using the view element is required for all Helium application views as all other view components including data input widgets and data output widgets are placed within it.



Example

The following code snippet shows and example of how to use the view element.

View XML
<?xml version="1.0" encoding="UTF-8"?>
<ui xmlns="http://uiprogram.mezzanine.com/View"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://uiprogram.mezzanine.com/View ../View.xsd">
    <view label="view_heading.shop_management" unit="ShopMgmt" init="init">
    .
    .
    </view>
</ui>
Backing unit
unit ShopMgmt;
.
.
void init() {
    .
    .
}
en.lang file entry
 view_heading.shop_management = Shop Management
  • label="view_heading.shop_management"
    This specifies the heading that will be displayed for the view. It is required and references a key in the lang file.

  • unit="ShopMgmt"

    References from views to unit functions and variables can be done in two ways. Firstly, using the fully qualified name for the function or variables. This includes the unit name followed by a colon followed by the name of the function or variables. For example: MyUnit:myFunction or MyUnit:myVariable. Another way to reference a function or variables in a view is to first specify the default unit for the view, as shown the code example above and them simply using the function and variable name for reference.

  • init="init"

    It is often useful to have a unit function execute when a view loads in order to perform some initialization operations such as initializing unit variables used in the view. This is achieved by specifying the init function as in the example above:  init="init". Note that if a default unit is not specified, the init function has to be referenced using its fully qualified name: init="ShopMgmt:init". Note that init functions are only executed when a view is loaded as a result of navigation to that view from a different view or as a result of menu action.