OtfGenericScreen

From emotive
Jump to navigation Jump to search

Introduction

The HMI extension (Human Machine Interface) provides access for interacting with the user through the display of graphical screens. To achieve this goal, there are two ways to operate with screens:

  1. Basic Screen - A set of basic dialogs providing by the operating systems
  2. Custom Screens - Customizable screens that allow arbitrary flexibility

Custom screens only define an interface to a screen. The screen itself is externally created. The layout and functionality of this screen is not defined in the OTX. The interface to the screen is the OTX Screen Signature. A Screen Signature defines all IN-, OUT- and INOUT-Parameters of a screen. The OTX Runtime have to map the Screen Signature Parameters to the proper screen controls. The OTF supports two kinds of Custom Screens:

  1. Generic Screen
  2. Screen Mapping

Generic Screen

As the name said, Generic Screen is completely data driven. Only the Screen Signature have to define. Via Data Binding mechanism the screen controls will be updated automatically and vice versa. Particular attention is paid to the category attributes of the parameters. Each category is mapped to a Pane inside the Form layout. The default layout can be used or the layout can be adapted. In most cases, the supplied default layout is sufficient. The next section shows how the layout can be changed.

In opposite to the Screen Mapping the layout possibilities of the Generic Screen can be adjusted in a wide range but they are limited. The layout of the Generic Screen is stored in a XML file. The file is located in:

ProjectFolder/HMI/ProjectName.otfSLay

Inside the folder an annotated schema file which describes the layout is also stored.

ProjectFolder/HMI/ScreenLayout.xsd

In the following section the generally layout is descibed.

Screen Layout (Table Layout)

The Screen Layout of Generic Screen is implemented as a so called dynamic Table Layout. The Table Layout arranges its contents in a grid, providing functionality similar to the HTML

element. The Table Layout allows you to place controls in the layout without requiring to precisely specify the position of each individual control. Its cells are arranged in rows and columns, and these can have different sizes. Cells can be merged across rows and columns inside Panes. A Pane can contain any supported control. The picture below shows a sample. The Table Layout also provides a proportional re-sizing capability at run time, so your layout can change smoothly as your form is re-sized.
GenericScreenTableLayout.png
HMI Generic Screen - Table Layout Sample

The layout in the picture above contains three columns and three rows with described width and height. Six Panes are specified in the layout. For example, Pane 3 spans three cells in the last row and is assigned to the Category "BUTTON", see sample layout file below.

At runtime, the following rules are applied to the layout:

  1. A Layout described in layout file can be assigned to one ore more Screen Signatures. If a Screen Signature is not assigned to a layout the default layout is used. The default layout is the first layout with the attribute Default="true". If not exist the first layout is the default layout.
  2. The OTX OpenScreen activity opens a window for one Screen Signature. If a Pane refers to that Screen Signature, the window is docked to that pane.
  3. Screen Signature Parameters with a specified category will be mapped to the first Pane with the same category. If the category cannot mapped to a Pane, the default pane - with empty category - is used. If no default category exist, the parameter will not mapped.
  4. Each mapped Parameter creates a new control. The type of the control depends on the data type of the parameter and/or the category.
  5. If more than one parameter is mapped to a Pane the additional parameter can be added in a new row or a new column of that Pane, see GrowStyle

More details about the Table Layout are described in the annotations of the schema file (ScreenLayout.xsd).

In Built Categories

A Screen Signature Parameter can have an arbitray string as Category. This category will be matched to a Panel category inside the layout file. Furthermore there are some built in Categories with special meaning, described below:

Built-In-Category Meaning
NONE Default category which is used, if no other category will match. Controls related to the data type of the parameter will be created, see below.
TITLE or MESSAGE or WARNING A Label control is created.
GRAPH A Graph control is created.
BUTTON A Button control is created.
CHECKBOX A CheckBox control is created.
INPUT A TextBox control is created.
CHOICE A ComboBox control is created.
PROGRESS A ProgressBar control is created. The Parameter should be of data type Integer. The range is restricted to 0 ... 100.
GRID A DataGridView control is created. The Parameter should be of data type List<List<SimpleType>> or Map<String, List<SimpleType>>. The Map contains headers in the grid the List contains no headers.
Enabled This parameter will not displayed directly. The parameter specifies the enable/disable state of antoher parameter and should be of data type Boolean. The value list is assigned to another parameter which name contains the name of this parameter trimmed by "Enabled" and "_" (e.g. Parameter "Selection_Enabled" of data type Boolean is assigned to Parameter "Selection1" of data type String).
ValueList This parameter will not displayed directly. The parameter contains a value list and should be of data type List<String>. The value list is assigned to another parameter which name contains the name of this parameter trimmed by "ValueList" and "_" (e.g. Parameter "Selection_ValueList" of data type List<String> is assigned to Parameter "Selection1" of data type String).
Icons Note.png In each other category controls related to the data type of the parameter will be created, see below.

Control/data type dependency

...

Sample Layout file

<?xml version="1.0" encoding="UTF-8"?>
<Screen xmlns="http://www.example.org/ScreenLayout" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/ScreenLayout ScreenLayout.xsd">
  <Display Text="Generic Screen Sample" ShowIcon="true">
    <MinimumSize Width="480" Height="320" />
    <Size Height="480" Width="640" />
  </Display>
  <Layouts>
    <Layout ColumnCount="3" RowCount="3" Default="true">
      <ScreenSignatures>
        <ScreenSignature Name="NewDefaultPackage1.Doc_NewDocument1.ScreenSignatureFrame" />
      </ScreenSignatures>
      <Columns>
        <Column Size="50%" />
        <Column Size="50%" />
        <Column Size="100" />
      </Columns>
      <Rows>
        <Row Size="" />
        <Row Size="100%" />
        <Row Size="" />
      </Rows>
      <Panels>
        <Panel Category="TITLE" Column="0" Row="0" ColumnSpan="2" RowSpan="1">
          <Font Name="Segoe Condensed" Size="24.0" />
          <Dock>Fill</Dock>
        </Panel>
        <Panel BackColor="Gray" Category="" Column="0" Row="1" ColumnSpan="2" RowSpan="1">
          <ScreenSignatures>
            <ScreenSignature Name="NewDefaultPackage1.Doc_NewDocument1.ScreenSignatureContent1" />
            <ScreenSignature Name="NewDefaultPackage1.Doc_NewDocument1.ScreenSignatureContent2" />
          </ScreenSignatures>
          <Dock>Fill</Dock>
        </Panel>
        <Panel Category="MESSAGE" Column="2" Row="0" ColumnSpan="1" RowSpan="2">
          <Title Text="Status">
            <Font Name="Segoe Condensed" Size="18.0" />
          </Title>
          <Dock>Fill</Dock>
        </Panel>
        <Panel Category="BUTTON" Column="0" Row="2" ColumnSpan="3" RowSpan="1" AutoSize="true">
          <Title Text="" />
          <GrowStyle>AddColumns</GrowStyle>
          <Dock>Right</Dock>
        </Panel>
      </Panels>
    </Layout>
    <Layout ColumnCount="1" RowCount="1">
      <ScreenSignatures>
        <ScreenSignature Name="NewDefaultPackage1.Doc_NewDocument1.ScreenSignatureContent1" />
      </ScreenSignatures>
      <Columns>
        <Column Size="100%" />
      </Columns>
      <Rows>
        <Row Size="100%" />
      </Rows>
      <Panels>
        <Panel Category="" Column="0" Row="0" ColumnSpan="1" RowSpan="1">
          <Dock>Fill</Dock>
        </Panel>
      </Panels>
    </Layout>
    <Layout ColumnCount="2" RowCount="1">
      <ScreenSignatures>
        <ScreenSignature Name="NewDefaultPackage1.Doc_NewDocument1.ScreenSignatureContent2" />
      </ScreenSignatures>
      <Columns>
        <Column Size="50%" />
        <Column Size="50%" />
      </Columns>
      <Rows>
        <Row Size="100%" />
      </Rows>
      <Panels>
        <Panel Category="MESSAGE" Column="0" Row="0" ColumnSpan="1" RowSpan="1">
          <Title Text="Message">
            <Font Name="Segoe Condensed" Size="18.0" />
          </Title>
          <Dock>Fill</Dock>
        </Panel>
        <Panel Category="" Column="1" Row="0" ColumnSpan="1" RowSpan="1">
          <Dock>Fill</Dock>
        </Panel>
      </Panels>
    </Layout>
  </Layouts>
</Screen>