Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

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. This is required for all Helium application views as all other view components including data input widgets and data output widgets are placed within the view element.

 

 

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 function and 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 variables names.

  • 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".

 

 

  • No labels