Top Banner
Table of Contents - User Guide Introduction The TILCON difference What’s new in Version 4 How the manual system is organized Overview Target Requirements QNX 4.x QNX 6.x MS NT Embedded Creating A Tilcon Component Included Tilcon Files Included DLL Files Example .kdf file MS CE Embedded Creating the CE Platform Adding Tilcon Components Creating The CE Image Wind River fi VxWorks Configure Tornado to run the application Create the VxWorks image file Configure WindML to run the application Build the VxWorks image file To create a boot disk 1
43

User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Mar 30, 2018

Download

Documents

vodan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Table of Contents − User Guide

Introduction

The TILCON difference

What’s new in Version 4

How the manual system is organized

Overview

Target Requirements

QNX 4.x

QNX 6.x

MS NT Embedded

Creating A Tilcon Component

Included Tilcon Files

Included DLL Files

Example .kdf file

MS CE Embedded

Creating the CE Platform

Adding Tilcon Components

Creating The CE Image

Wind River fi VxWorks

Configure Tornado to run the application

Create the VxWorks image file

Configure WindML to run the application

Build the VxWorks image file

To create a boot disk

1

Page 2: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

To transfer the application

Configure Tornado compiler

Connect to the target

Downloading and running the application

Colors

Transmit Keys, Shortcut Keys

2

Page 3: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Overview

How the TRTD works

Building a real−time application

Porting your application to

another TRTD−supported platform

Concepts

Notification and callback

Objects

Components

Fonts

Component Index

Object spaces

Scalability

Triggers

TCP/IP

How the TILCON Channels work

Redraw options

Redraw object

Area redraw

Never

Returns

Running your real−time application

Structure

Attributes

Setting and getting specific attributes

(TRT_SetValues and TRT_GetValues)

3

Page 4: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Common attributes

Attribute data types

Character strings

Attribute values using TRT_VarLen

Attribute flags

Using TRTConst.h and other headers

Using TRT_ATT_CHANGE

and TRT_ATT_CURRENT

Compiling and linking

Sample application

4

Page 5: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

The Toolbox

Adding Objects to Your Work Window

Editing an Existing Object

Fine−tuning an Object's Appearance

Animation

Animation Area

To find an animation area for editing

Animation Object

Rotate Animation Object (.tsy & .cgm)

Button

To add a button to your window

To select On/Off button options

To add a button image

Charts

To create a new chart

To select a type of chart

Data selection

Scale options

To create Error Limits

For Area, Bar and Stacked bar charts

Scrolling Options

Pie Chart selections

Checkbox

To add a Checkbox to your window

To add an image to the Checkbox

Clock (Date and Time)

5

Page 6: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

To add a clock

Color Combobox

To add a color Combobox

Color Listbox

To add a color listbox

Color State Object

To add a color state object

Combobox

To add a Combobox

Directory box

To add a Directory box

Draw Tools

Fill Meter

To add a Fill meter

Meter Rotate Options

Meter Depth/Placement/Sizing Options

HTML File Display

To add a HTML File Display

Listbox

To add a Listbox to your window

Menu

Menu item behavior

To add the main menubar

To add a sub−menu

Menu Form in QNX Photon microGUI

Multi−State Objects

6

Page 7: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

To add multi−state objects

Needle Meter Body and Needle Options

To add a Needle meter body to your window

Meter Rotate Options

Meter Depth/Placement/Sizing Options

Needle Options

Number box

Panel

To add a Panel

Radio Button

To add a radio button to your window

To add an image to your item

Raw Image Object

To add a Raw Image to your window

Scale

To add a Scale

Scroll Area

To add a scroll area

Selector (Find) Tool

Slider

To add a slider

Size/Depth/Placement form

Spectrograph

To add a spectrograph

Tabbed Notebook

To add a Tabbed notebook

7

Page 8: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Table

To add a Table

AutoGenerate Labels

Editing objects in a table

Text Tools

Tool bar

Tree

To add a Tree

8

Page 9: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

1 Introduction

Welcome

The TILCON Real−Time Developer is a fast, easy to use, multi−platform application developer. It is a quickway to create powerful real−time applications for QNX 6.2, MS Windows 98/2000/ME and Windows NT,Windows CE, and other platforms supported by TILCON. You can port your application created with theTILCON Real−Time Developer from one operating system to another without any code changes. That optiongives you maximum flexibility. It simplifies application development and significantly reduces yourprogramming time and effort.

1.1 The TILCON difference

The architecture of the TILCON Real−Time Developer is the difference! The TILCON Real−Time Developerprovides you with the TILCON Graphics Editor and the TILCON Run−Time. Your application communicateswith the Run−Time using TILCON API (Application Programming Interface) function calls. The Run−Timeis specific to a platform. This means that without any change in code, your application can operate on anyplatform for which a Run−Time is available.

The TILCON Graphics Editor consists of powerful integrated tools to create the windows , menus, buttons,boxes and all other user interface objects for your real−time application. These tools represent object−orientedtechnology and are cross−platform compatible.

In the window creation stage of your application, you can specify triggers and links which allow objects to beupdated or actions to occur without the need of API functions during real−time display. In effect, triggers andlinks build programming right into your window and enable buttons and other interfaces in your application todisplay information more quickly.

The TILCON Run−Time monitors the interactions between end−user and application. This powerful toolkitprocesses trigger and link updates, notifies the real−time application when the user selects graphical userinterface (GUI) objects, and allows the application to update objects within the windows by means of Cfunction calls (the TILCON API).

This describes the basics of the TILCON Real−Time Developer. If you have used a previous version of theTILCON Real−Time Developer the “What’s New in Version 4.0” will be of particular interest.

Contents

New features in Version 4.0• How this manual is organized•

1.2 What’s new in Version 4

TILCON's version 4 is the culmination of an intensive design effort.

A major goal was the implementation of full dynamic creation and editing capabilities. All objects in version4 can be created or edited dynamically. Version 4 features a highly simplified API consisting of a handful offunctions (Create, Simple Create, Get Values, Set Values, Display, Delete...being the core functions) alongwith a name/value paired list of attributes affecting all of the objects characteristics. The result in anunparalleled level of dynamic configuration abilities and fine tune control to the developer over the

1 Introduction

9

Page 10: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

appearance and behavior of objects at runtime.

TILCON has added numerous enhancements to the Graphics Editor and to the TILCON objects to make yourjob easier, provide outstanding flexibility and allow you to effortlessly implement the functionality of objects.

Users of previous versions of TRTD will note that window capabilities have been drastically enhanced.TILCON now offers industry−first scalable windows. Color options now include all 3 color models (RGB,CMYK, HLS) as well as the TILCON Color Palette. Inverted colors, transparent icons, true color bitmaps arenow supported. Fountain fills (radial, log, linear) are now available. Line, edge cap, pattern options have beenexpanded. TILCON’s Raw Image object allows you to import vector and raster images.

TILCON now offers fully customizable, segmented text for LCD or LED displays. A highly versatile TreeObject is now provided for convenient display of hierarchical items. New standalone scale provides many newoptions. Expanded capabilities and images handling for listbox and comboboxes. Pop−up menus are nowavailable for most objects. Tab notebooks now offer many new options including bottom, left and right sidetab options.

The TILCON Graphics Editor is now fully an application of the TILCON Runtime. With the power andversatility of the TILCON’s API, developers of SCADA or other highly distributed applications will now beable to easily create their own fully customized editors. To facilitate this task, TILCON will be selling editorsource code.

A brief summary of the main features of the principal TILCON objects will follow.

Buttons: can respond in a variety of ways to 'clicks' depending on the button type − spring, toggle,repeating, on/off and instant button types are available. Use vector and raster images tocomplement or replace textual labels. Customize shape, shading, dimming, blinking andhelp bubbles. Notify your application of events, invoke callback functions, and/or build alist of commands to be triggered in response to the 'clicks'.

Radio Buttons: manage a group of buttons; selecting one item automatically de−selects the others in thegroup. Apply vector/raster images and help bubbles to each label. Customize layout, bullets,shading. Triggers and callbacks are available for individual items, as well as notification ofthe selected item by the group.

Checkboxes: offer an array of checkmarks, layouts and shadings. Add vector/raster images and helpbubbles to the label. Respond to user actions by notifying the application, invoking acallback, or triggering a pre−defined list of commands.

Scroll Areas: these containers with scroll bars allow you to group many or large objects into a small areaof your window. Any object can be placed into a scroll area, including background images(e.g. maps) over which other objects can be layered. Choose the viewed size, total size,shadings, and scrollbar options.

DirectoryBoxes:

allow the user to choose from a list of files. Drive, directory, filename and file type areshown; file types can be limited so only certain types are visible to the user. An invaluabletool for 'Open' and 'Save As' forms!

Toolbars: attach themselves to any edge of a window − top, bottom, left or right. They provide space

1 Introduction

10

Page 11: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

for vital information that should be displayed even when the main contents of a windowchange. Clocks, warning messages and status indicators are a few objects commonly placedin toolbars, which can be customized in layout, shading, as well as in content.

Trees: provide a visualization of a hierarchical list of items. Trees are built quickly and easily:each item is added as a child or sibling of a previous item. Branches expand and collapse inresponse to user 'clicks'; selected items can trigger commands or send notifications to theapplication. Customize each item by adding an image, changing its shading or providing ahelp bubble.

Color Listboxes/Comboboxes:

are simple tools for providing a choice of colors to the user. A palette of 256 colors isavailable through these listbox and combobox objects.

Listboxes: allow the selection of one or more items from a list. Tailor the listbox behaviour to yourneeds by choosing multiple/single selection, specifying the orientation and sorting of theitems, and setting the conditions under which notifications are sent, callbacks invoked, orcommands triggered. Specify multiple columns with individual widths. Provide images,help bubbles, hiding, dimming and colors for each item.

Comboboxes: combine a text field and a listbox. Choose a popup or static listbox, editable or non editabletext, and an array of options for both listbox and text components: layout, colors, images,shading, help bubbles, to name a few.

Numberboxes: are the perfect tool for numeric input. Control the layout of the editable text, repeatingarrows and label. Specify minimum, maximum values, decimal accuracy, number of digitsdisplayed, justification, arrow increments and help bubbles. Set the conditions whennotifications are sent, callbacks invoked, or commands triggered. Customize the appearanceby setting colors, shading and other options. Link to other object to share a common value.

TabbedNotebooks:

group objects into related categories, each contained in its own folder. Selecting a tabchanges the active folder, allowing many choices in a form while using little real estate.Tabbed Notebooks options include setting the location, shape, font, default colors, highlightcolors, and labels of each tab, as well as the colors for each folder in the notebook.

Panels: a very common tool for grouping objects, these containers are surrounded by a 3−D borderwith an optional label at the top. All objects in the panel can be moved as one, hidden, cut,copied, pasted − by performing these actions on the panel itself. The type of 3−D border,the label and all colors can be customized.

HTML FileDisplays:

will, as the name implies, display an html page given its URL. Use this to create on−linehelp applications, or maybe even your own web browser! Font, scrollbar and notificationcontrols are built in (where applicable).

LCD Text: simulates the segmented text of an LCD or LED screen. Ideal for realistic−looking displays,e.g. for calculator applications and consumer appliance displays. Customize the segmentsizes, margins and colors.

1 Introduction

11

Page 12: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Raw Images: are used to import vector and raster images into a window. Like all objects, they have theirown frame, can be moved about the window, and can send notification of mouse clicks...they can even display a help bubble.

Text: editable, message, label and multi−line forms of text are available to meet the need fortextual objects. Editable and multi−line text can respond to user interaction and events −gaining focus, losing focus, individual keystrokes − by sending a notification, invoking acallback or triggering a command. International text is supported, as are input masking,formatted output, and a wide assortment of fonts and sizes. Other attributes includejustification, colors, dimming, hiding, linking to other objects, blinking, and help bubbles.

Tables: provide spreadsheet−like control of your data I/O. Each column can contain its own type ofobject, including editable text, message text, raw images, numberboxes and comboboxes.Every cell has all the options and attributes available to the type of object it contains, sotables provide vast amounts of built−in functionality and configurability. In addition towhich the table has many attributes of its own, including row/column dimensions, scrollbaroptions, grid line options and colors, and sorting. And, as with all objects, every attributecan be modified dynamically!

Fill Meters: are an invaluable tool for process−control applications, where a value is represented by thefill level within an outer body. Updates are smooth, fast and flicker−free. In addition to thepredefined shapes (square, rounded, triangular, thermometer), vector images can beimported. Fully configurable scales are automatically attached; calculations can be built in;and the value can be linked to other objects. The meter can fill from its minimum or from 0;it can also change its fill color automatically as its value crosses 0. Other features includecontrol of the colors and borders of each component.

Needle Meters: are formed after adding one or more Needles into a Needle Meter Body. An array of bodyshapes are available, defining the behaviour of the needles; they can also be hidden so theneedles are shown over imported images, increasing their realism. As with fill meters,scales are automatically attached, and needle updates are smooth and flicker−free. Needlesoffer an array of predefined shapes and widths; vector images can also be imported toincrease realism. Links can be made to other objects; calculations can be applied to valuesbefore they are displayed. Other options affect colors, tip/tail lengths, and pin shape andsize.

Color− andMulti−StateObjects

are ideal alarms. They are configured to have one or more 'states' corresponding to a rangeof values. When the value in the object crosses the boundary from one state to another,either the color or symbol of the object changes, and the object can trigger a command ornotify the application of this event. Vector images are imported and used as the symbols.Blinking can be set for each state individually; links can be made to other objects; andcalculations can be applied to values before state changes are assessed.

Scales: numeric, alphanumeric, date and time stand−alone scales provide the perfect complement todrawings, animation and other objects. With the choice between linear or circular shapes,linear or logarithmic increments, a tri−colored alarm indicator, and a battery of configurableoptions for the text and tickmarks, the scale offers complete versatility.

1 Introduction

12

Page 13: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Menubars: placed at the top of the window, the menubar provides multiple levels of drop−down menuitems. The cascaded sub−menus provide command, toggle and radio button behaviour foreach of their items. Each item can send a notification, invoke a callback or trigger acommand upon its selection. Additionally, Pop−up Menus can be created in most objects;these appear when a 'right−click' occurs on an object that has defined a pop−up menu.

Sliders: provide a visual method for numeric input. The slider offers predefined and custom handleimages, optional end−buttons, attached scales, and a choice of directions. Customize thelayout and appearance of each of its components. Set the conditions under which the sliderresponds to user input − by notification, callback or trigger.

Clocks: offer the display of current date or time in a variety of formats. Fonts and colors are alsoconfigurable.

Charts: represent data as a function of an independent (x) variable, where each y−series provides adata point for each x−value. The x−data may be numeric, alphanumeric, date or time;attached scales can represent each of these cases. Charts offer multiple ways of plottingtheir data: as scattered points, as connected lines, as solid areas, as pie slices, as vertical orhorizontal bars, as stacked bars or areas when more than one series is supplied. Series canalso be used to create x/y error bars or high−low plots. Other features include auto−scaling,dual y−scales, markers for each point, individual colors for each line/area/marker, limitsabove/below which plotted colors change, linear/log increments for each scale, and manyother options affecting the chart's appearance. Functions are provided to update the chartone point at a time or in groups of points (like an oscilloscope) or to scroll data onto thechart (like a strip−chart recorder). Like in other objects, every attribute of the chart is fullydynamic and can be changed either during development or programmatically.

Spectrographs: display a raster image in an array of cells. However, this data is supplied by directly settingthe colors for each cell rather than through the use of an image file. With a configurable cellsize, variable number of rows and columns, and the ability to scroll the spectrograph's datatowards any edge, this object provides a simple yet powerful alternative to raw images forapplications that have immediate access to the data that will form the image.

AnimationAreasand Objects:

provide smooth motion for vector images and raster images, and smooth sizing and rotationfor vector images. The area defines the space in which the objects may move and sets up acoordinate system scaled to that area. Object position, and the size and rotation of vectorobjects, are calculated with respect to the animation area coordinates.

1.3 How the manual system is organized

Getting Started

The TILCON Getting Started manual contains instructions for installing the system .It also contains a set oftutorials that explain the operation and creation of various GUI/MMI objects, text tools, color, draw functionsand window creation. It is highly recommended for first time users or if you are just browsing to see what thesoftware can do. The manual also contains the instructions for installing the software.

Users Guide

1 Introduction

13

Page 14: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

The TILCON User's Guide manual is designed for the convenience of the real−time applicationprogrammer/screen developer.

This manual provides an overview of the TILCON Real−Time Developer system. It defines the interfaceelements of the product and explains how to use it.

Editor

This manual covers the basics of creating a real−time application window.Also described here are the draw functions and symbol creation features as well as a library of symbols,bitmaps and icons which are provided with the software.

API Reference Manual

The TILCON Application Programming Interface manual contains the API function calls (for monitoring theinteraction between end−user and real−time application) and explains how to get the application up andrunning.

Chapter 1 provides explanations on how to get the application running and the complete explanation ofTILCON function calls for monitoring the interaction between the end−user and the real−time application.

Chapter 2 contains the attributes pertaining to and descriptions of TILCON objects.

Chapter 3 contains the component attributes and descriptions, which are common to many of the objects.

Chapter 4 contains the C++ library.

ODBC Feature Manual

The TILCON ODBC Feature Manual contains the API function calls for the ODBC Feature. This manualdescribes the TILCON ODBC Feature and how to use it.

OPC Feature Manual

The TILCON OPC Feature manual contains the function calls for the OPC Feature. This manual describes theTILCON OPC Feature and how to use it.

Maps Feature Manual

The TILCON Maps Feature Manual contains the function calls for the TILCON Maps Feature. This manualdescribes the TILCON Maps feature and how to use it.

Utilities Manual

The TILCON Utilities Manual contains descriptions and operating instructions for provided TILCON utilities.

The information contained in all of these manuals is also available via TILCON’s on−line help function. TheGetting Started manual is provided with the software. The other manuals are available at a cost if requested.

Pictures used in these manuals

1 Introduction

14

Page 15: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

The pictures used throughout this manual are snapshots taken from the Microsoft 95/98/NT version ofTILCON’s Real−Time Developer. There may be slight differences between your screens and the onesdepicted here.

Instructions in these manuals

Most of the instructions in this manual are based on mouse actions for using TILCON Real−TimeDevelopment Software. In most cases, keyboard methods are omitted. Where keystrokes appear, the name forthe key usually appears in CAPITAL letters. Key combinations are indicated with plus signs; Alt+Ctrl+Del,for instance, means that you should press all three keys at the same time.

To create objects, to select objects, to alter their properties, and to open forms with additional options, click onthe object using the left mouse button. If there are selectable elements within the object, you can then selectany one of them with a click. Once an object (or element) is selected, you can apply the options in the Mainmenu or Speedbar that are relevant to it (color, for instance).

To access the real−time properties of the object

Click the right mouse button. An attribute modification screen will appear to allow the attributes of the objectto be modified.

1 Introduction

15

Page 16: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

2 Overview

2.1 How the TRTD works

The main advantages of the TILCON Real−Time Developer are the ease and speed with which you candevelop dynamic real−time applications and port them from one TILCON−supported platform to anotherwithout recoding.

This simple diagram illustrates how the two components of the TRTD –– API and TILCON Runtime ––interact with your application to deploy it in real−time.

Your application

It interacts with the real world by monitoring real−time data, reacting to messages, button clicks, etc. Youvisually develop the windows of your application interface in the TILCON Graphics Editor. The GraphicsEditor saves each window and its contents as a collection of objects — not as platform−specific code. Theresulting .twd files can be used without modification on any platform. Your application communicates onlywith the TILCON Runtime using API commands.

TILCON Runtime:

This program is the go−between your application and the windowing system. It contains the Graphics Enginethat interacts with the windowing system in response to API commands. It knows how to read a .twd file; howto create a window from it; and how to create all the buttons, text, charts, meters and other objects within thewindow. It knows what windowing system commands to use to update an object; how to get the value storedin an object; and how to detect when the user changes an object. It runs side−by−side with your applicationand in response to its API commands loads and displays the required windows, puts values into the meters,charts and other objects. The Runtime tells the application about text modifications, button clicks and otheruser interactions with objects in your interface window.

TILCON API:

This is the library of functions and attributes that your application calls up to start the Runtime andcommunicate with it.

2.2 Building a real−time application

1) Your application starts the Runtime and opens a line of communication with it using the onlyplatform−specific API command: TRT_Start

2 Overview

16

Page 17: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

If the Runtime is already running, TRT_Start can be used either to gain and share access to the existingobjects, or to create an independent “object space” (see Concepts) for your process. After performing someinitialization commands, your application will then instruct the Runtime using API commands to load andpossibly display the introductory windows of your interface or create them dynamically.

2) The API commands are mostly called within the control process and pass instructions that are queued intothe Graphics Engine of the Runtime. The commands, which are asynchronous, don’t have to wait for thedisplay to be updated before returning to its task of monitoring/controlling the real−world system. (If acommand waits before passing control back, it is said to be synchronous) The Graphics Engine isolates theGUI calls from the control application as a separate process to allow the control application to be real−time.

3) In the Web environment, the Graphics Engine relays messages along TCP/IP. Your application can interactwith other windows and nodes over the Web.

2.3 Porting your application to another TRTD−supported platform

All api and .twd files of your TRTD application are stored as data files, not C code, and can be used withoutmodification on any other supported platform.

To port your TRTD application:

1) Copy your code and .twd files to the file system of the new TRTD−supported platform

2) Compile with the TILCON library native to that platform

3) Run your application and the Runtime native to that platform. Your only platform−specific API function isTRT_Start, which starts the Runtime for that platform.

2.4 Concepts

2.4.1 Notification and callback

The API commands involved in notification and callback are: TRT_GetInput and TRT_ReceiveData. When anotification or callback occurs, the kernel queues a structure describing the event, then kicks the applicationand returns to its own main loop. The application, at its convenience, executes the API command,TRT_GetInput, to receive the next event in the notification queue. If this event is a callback, the callback isexecuted before returning from the TRT_GetInput function call. If the event is processed by a callback, thereturning value is 1.

2.4.2 Objects

In simplest terms an object is any window, shape or text that has an ID. Each object has specific attributessuch as its size and common attributes like colour that control its appearance and behaviour. Object attributesare described in Section 3.

Animation AreaEditable Text Multi−line Text Spectrograph

Animation Obj Groups Needle State Objects

Button Html Numberbox Tab Notebook

Charts Label Text Panel Table

2 Overview

17

Page 18: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Checkbox LCD Text Radio Button Tree

Clock Listbox Real Image Window

Combobox Menu Items Scale

Directory Box Message TextScroll Area

Draw Tools Meter Slider

2.4.3 Components

Objects can contain components. For example, the button object can have alarms which are components.

Alarms Common Images Scales

Anchor Container Indicators Scrollbars

Angle Cursor Types Items Tab NotebookItem

Blinking Draw Components Link Group Tabbing

Borders (Frames) Fields Notification TextComponent

Bubbles Files Popup Menu Triggers

Calculations Fountain Fills Position

Callbacks Highlight Pulldown Menu

2.4.4 Component Index

To ‘Get’ and ‘Set’ the attributes of the components a Component Index is used to point to a component.

2.4.5 Fonts

The TRTD uses a font driver to render text objects either to the screen or to an offscreen image. This driverhas a small footprint and is fast.

The TRTD maintains an internal list of all fonts. A font file is loaded only once. An initial list of True Typefont files is supplied with the TRTD. Additional fonts can be added to the registry using theTRT_RegisterFontFile API command.

The appearance of the text can be altered by using the TRT_SetValues API command to affect the textproperties such as size, bold/italic, underline etc.

If a Window is resized, the text will be scaled appropriately.

Fonts are fully scalable and not limited to particular point sizes. The Editor, however, is limited in the numberof sizes in its font selection combobox.

Anti−aliasing is supported.

All valid TRTD colors including transparent, XOR (both inversion of background and XOR'ing backgroundwith a color) is supported. Also provided is a variety of shadow types and shadow colors. These properties canbe set individually.

2 Overview

18

Page 19: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

The application program uses the TRT_GetValues and TRT_SetValues API commands to get / set the the fontattributes. These attributes are of the form TRT_ATT_FONT_*.

Four text types are supplied with the TRTD:

Helvetica Courier New Century Times Roman

2.5 Object spaces

An object space is a description of an instance of the window(s) environment. Each object space is a differentinstance of the window environment. An object’s ID must be unique within a given object space, but twodifferent object spaces may each contain the same window and/or object.

ODBC

For an overview of the ODBC Feature, please refer to the ODBC Manual.

OPC

For an overview of the OPC Feature, please refer to the OPC Manual.

2 Overview

19

Page 20: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Maps

For an overview of the Maps Feature, please refer to the Maps Manual.

2.6 Scalability

The TILCON Real−Time Developer enables you to create a custom−configured kernel, which is composedonly of the components required by your application. With this scalable kernel option, you can compile amuch smaller kernel using less RAM. The scalable option allows you to discard any unnecessary softwareoverhead. This of course, is especially significant in embedded systems where memory is at a premium. Anapplication, for example, that never uses animation does not require a Runtime kernel with animationcapabilities.

Using a utility in the TRTD and a simple point and click interface, you can select the desired capabilities fromthe available set of TILCON libraries. The utility then produces a makefile that can be used to link theappropriate libraries to create the scaled down Runtime kernel.

2.7 Triggers

Triggers are handled exclusively within Runtime. Triggers are API commands that were built into the objectsthemselves when they were created. In response to specific events – foe example, a checkbox becomingun−checked – the Runtime executes the trigger that was built into the selected object. In this way, a buttoncould be used to dim several fields and display a window, without the need for Runtime to communicate withyour application

2.8 TCP/IP

2.8.1 How the TILCON Channels work

The Tilcon channel is a mechanism through which communication takes place between two processes (orthreads).For example, between an application and a runtime. The channel is said to have two "ends". Amessage sent from one end, arrives at the other end. These commands support a standard interface for sendingand receiving messages so that an application (without a runtime) can easily communicate with a TILCONruntime on another machine. Channels are used internally by the Tilcon API to exchange data between anapplication and the Tilcon kernel. There are also explicit channel API functions that an application can use forinterprocess communication. Each thread must create its own channel ends. A thread should not share achannel end with another thread. The Tilcon channel mechanism is based on the Send/Receive?reply model. Ituses the native IPC mechanism when communication is between threads on the same machine and TCP/IPbetween machines. The TRT_ChTrigger call is a non−blocking send.

With this architecture, one process could create a channel and another process could connect to that channel.The first process could then use the channel to send a TRT_GetInput command to the second process whichcould then reply with the requested data.

An application can connect to many remote runtimes each running on a different but supported platform. Eachremote channel is identified by a channel ID and channel name.

There are three phases to the life−cycle of a channel:

Connection: During this phase, a connection is established between two ends. Communication: During this

2 Overview

20

Page 21: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

phase, messages are sent between ends. Termination: During this phase, the connection between the ends isdisconnected.

In the following descriptions, the pertinent Tilcon API calls are described for each of the above mentionedphases for each of the architectures identified.Architectures:

Application – Runtime Same Machine

Application – Runtime Different Machines

2 Overview

21

Page 22: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

The TRT_StartEX will not launch the kernel in the remote machine. The kernel in the remote machine mustbe running before the TRT_StartEX is called, or the TRT_StartEX call will fail.

The remote kernel can be started by calling the kernel with the −t option.

Application – Application Same Machine

2 Overview

22

Page 23: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

Application – Application Different Machines (Not yet Implemented)

2.9 Redraw options

2.9.1 Redraw object

In order to update an object, it must be redrawn. All or part of the object must be cleared and then drawn againto reflect new values or settings. This re−draw of the object may be done directly on the screen, or it may firstbe produced as an offscreen image, which is copied to the screen. There are differences between Onscreen andOffscreen Redraw.

Redrawing objects Onscreen is the quickest way to update them. However, because the old setting must becleared from the screen to draw and display the updated settings, the user often sees a flicker in the applicationwhere the clearing occurs. The Onscreen option is best used when the application must make a quick updateof an object that does not change very frequently. For example, if the text in a Message Text box is updated

2 Overview

23

Page 24: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

once every few minutes, the fast flicker that occurs does not repeat itself until a few minutes later. Thisflickering therefore, does not draw attention to itself.

By drawing first into the offscreen image and then copying that image to the screen, the user never sees thescreen cleared, and therefore sees no flicker. This is a recommended method for updating objects, which areconstantly changing such as a Needle−Meter or Fill−Meter.

If the object to be updated has other superimposed objects, you must decider whether you want to draw justthe object or the area that encompasses it.

Redraw Object− is the choice when an object stands alone, or when no other objects are layered above orbeneath it. Drawing only one object is much faster than redrawing its area, but that object will be drawn overany other object at that location.

2.9.2 Area redraw

This option redraws the object that you are updating and all other objects, which are layered on top and belowit. In effect, it draws the "area" which is affected by the update. In this way, an object is redrawn in its correctposition amidst the layers. If the area is drawn Onscreen, flickering will appear for the updating of the area. Ifit is done Offscreen, the layers are drawn from the back to the front, and appear much smoother whendisplayed.

2.9.3 Never

This option is useful for objects you do not wish to have redrawn when you know another update isforthcoming. ‘Never’ objects do not redraw themselves when they are updated, only when the area they are inmust be redrawn.

Example:

Let's create a new window, link a few objects together, and see how the Redraw Options affect the display ofthese objects. The objects that we are going to create are all 'Output Objects'. The user cannot set (input) theirvalues directly; they display (output) values that are set program

2.10 Returns

Every command returns a value:

0 – command successful

1 – critical error

other value – other type of error

2.11 Running your real−time application

2.11.1 Structure

A sample program structure for a typical real−time application is the following:

TRT_StartUP(…); spawns the TILCON Runtime

2 Overview

24

Page 25: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

TRT_WindowLoad(…); loads a .twd file into memory

TRT_WindowDisplay(…); displays the window

TRT_GetInput(…); queries TILCON Runtime for events/notifications

It receives the notification structure from Runtime and invokes any callbacks

TRT_MeterValue(…); changes the value of a meter (example of attribute change)

TRT_Exit(…); Runtime closes all windows and exits

2.11.2 Attributes

The way an object looks and behaves is controlled by attributes. All objects have a set of common attributesthat cause the same behavior. Each object has a set of attributes specific to itself. Some objects containcomponents. These components also have attributes.

2.11.2.1 Setting and getting specific attributes(TRT_SetValues and TRT_GetValues)

The functions needed to interact with an object's properties are:

TRT_SetValues to set the format etc. of the the attribute of the object

TRT_GetValues to obtain actual values for the attribute

These functions take a variable number of arguments; the last argument must always be a NULL pointer toshow that the list is complete. The arguments in these functions are paired. One parameter specifies whichattribute is to be changed or queried; it is immediately followed by the value to be assigned or, forTRT_GetValues, by a pointer to a variable that will hold the value of the queried attribute.

Some attributes cannot be set but only queried (e.g. TRT_ATT_RADIO_LAST_FOCUS). The Usagecolumn in tables describing object attributes in Section x, indicates whether the attribute can be used only inTRT_SetValues (S), only in TRT_GetValues (G) or in both (S, G).

Using the example of a clock, to set the format, etc of the time values:

2 Overview

25

Page 26: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

TRT_SetValues (TRT_cid, "my_clock",TRT_ATT_CLOCK_TYPE, TRT_TIME_CLOCK_TYPE,TRT_ATT_CLOCK_FORMAT, TRT_TIME_FORMAT_HHMMSS,NULL);

In addition to setting the properties of an object, TRT_SetValues can also be used to perform certaincommands. For example, TRT_SetValues can use TRT_ATT_LIST_DELETE_ITEMS to empty a listboxof all items.

To get the actual time:

TRT_GetValues (TRT_cid, "my_clock",TRT_ATT_CLOCK_FORMAT,&long_value,NULL);

2.11.3 Common attributes

Many attributes are common to more than one object and may even be used several times within a singleobject. For example, one border can surround a button; a second border can enclose its text; a third border itsimage; and a fourth border both the text and image. To set an attribute for one of these borders, the commandmust specify which border to modify. This is done using:

TRT_ATT_CHANGE_BORDER_TYPE to specify the border of interest (i.e. border around button)

TRT_ATT_CURRENT_BORDER_TYPE to identify which border is ‘current’ or of interest (i.e. this is theborder around the button)

// set the border enclosing the button to a one−tone look //

TRT_SetValues (TRT_cid, "my_button",TRT_ATT_CHANGE_BORDER_TYPE, TRT_CHANGE_FRAME_LOOK,TRT_ATT_BORDER_LOOK3D, TRT_ONE_TONE_LOOK3D,NULL);

// what's the look of the border around the button? //

TRT_GetValues, TRT_cid, "my_button",TRT_ATT_CHANGE_BORDER_TYPE, TRT_CHANGE_FRAME_LOOK,TRT_ATT_BORDER_LOOK3D, &look,NULL);

// which is the "current" border? //

// which_border should be set to TRT_CHANGE_FRAME_LOOK //

// if this follows the previous command. //

TRT_GetValues, TRT_cid, "my_button",TRT_ATT_CURRENT_BORDER_TYPE, &which_border,NULL);

2.11.4 Attribute data types

Built into each attribute is a flag indicating what data type is expected for the associated value. ForTRT_SetValues, the value can be a long, double, NULL−terminated character string, or a pointer to aTRT_VarLen structure. For TRT_GetValues, the value is a pointer to a long or double, a character buffer or

2 Overview

26

Page 27: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

a pointer to a char *, or a pointer to a TRT_VarLen.

2.11.4.1 Character strings

Using a character string in a TRT_SetValues call follows the same style as using a double or a long shown inthe previous examples.

char buff[] = "This is out";TRT_SetValues (TRT_cid, "my_button",TRT_ATT_BUTTON_OUT_TEXT, buff,TRT_ATT_BUTTON_IN_TEXT, "This is in",NULL);

The string must be NULL−terminated and, for non−ASCII text, encoded using UTF8 (the multibyte versionof Unicode).

For TRT_GetValues, there are two syntaxes for obtaining a string. If you know the size of the string andhave a buffer large enough to hold it, this syntax is faster:

char *cptr, buff[64]; // place string into pre−allocated buffer //TRT_GetValues (TRT_cid, "my_button",TRT_ATT_BUTTON_OUT_TEXT, buff,NULL);

If you don't know the size of the string in advance, then combining the attribute (not the value!) withTRT_ATT_ALLOC signals TRT_GetValues to allocate a buffer for you. In this case, you must provide theaddress of a character pointer, which you will have to free when you're done with it.

// allocate memory for the string //TRT_GetValues (TRT_cid, "my_button",TRT_ATT_BUTTON_OUT_TEXT | TRT_ATT_ALLOC, &cptr,NULL);

2.11.4.2 Attribute values using TRT_VarLen

TRT_Varlen is used with several attributes, in particular with Chart data and with Drawing objects.TheTRT_VarLen structure looks like:

typedef struct{

long length;void *buffer;

2 Overview

27

Page 28: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

} TRT_VarLen;

The buffer points to a structure specific to the attribute; the length is the size of that structure in bytes.

For instance, consider a chart, which plots one or more series of data (doubles) against x values. The attributeTRT_ATT_CHART_SERIES_DATA can be used to change some or all of the data for each series. Itsassociated structure is described in Appendix C as

{long num_pts;long first_index;double data[num_pts];

}

The size of the structure depends on num_pts.

To update the first ten points in a series, for example:

typedef struct{

long num_pts;long first_index;double data[10];

} Update10Points_St;

The code to update the first ten points of the first series would be:

void UpdateTenPoints(){

Update10Points_St update;TRT_VarLen cmd;long i;

// fill update structure //update.num_pts = 10;update.first_index = 0;for (i=0; i<10; i++)

update.data[i] = GetSomeValue();

// apply it into the TRT_VarLen structure //

cmd.length = sizeof(Update10Points_St); // size in bytes //cmd.buffer = (void *) &update; // points to the struct //

// update the chart //

TRT_SetValues (TRT_cid, "my_chart",TRT_ATT_CHART_CHANGE_SERIES, 0, // the first seriesTRT_ATT_CHART_SERIES_DATA, &cmd, // the varlen ptrNULL);

}

To update a variable number of points, a buffer of the right form must be created dynamically instead ofrelying on a structure.

void UpdateNPoints(long num_pts){TRT_VarLen cmd;

2 Overview

28

Page 29: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

long *lptr;double *dptr;long i; // the buffer will require 2 longs + num_pts doubles //cmd.length = 2 * sizeof(long) + num_pts * sizeof(double);cmd.buffer = malloc (cmd.length);

// the first two entries are longs //lptr = (long *) cmd.buffer;*lptr++ = num_pts; // number of points in update //*lptr++ = 0; // first point to update //

// then come the data, num_pts doubles //dptr = (double *)lptr;for (i=0; i<num_pts; i++)*dptr++ = GetSomeValue();

// update the chart //TRT_SetValues (TRT_cid, "my_chart",TRT_ATT_CHART_CHANGE_SERIES, 0, // the first seriesTRT_ATT_CHART_SERIES_DATA, &cmd, // the varlen ptrNULL);

// and free the buffer //free (cmd.buffer);

}

TRT_GetValues has the option of allocating space for the TRT_VarLen. However, the buffer contained inthe TRT_VarLen structure not the structure itself is allocated. The request for space allocation is, againsignalled by combining TRT_ATT_ALLOC with the attribute being queried, as shown in this example.

void GetSeriesData(){TRT_VarLen cmd;long *lptr, num_pts, first_index;double *data;

// get the data for the first series //TRT_GetValues (TRT_cid, "my_chart",TRT_ATT_CHART_CHANGE_SERIES, 0, // the first seriesTRT_ATT_CHART_SERIES_DATA | TRT_ATT_ALLOC, &cmd, NULL);

// interpret varlen structure //lptr = (long *)cmd.buffer;num_pts = *lptr++;first_index = *lptr++;data = (double *) lptr;}

When you know the size of the buffer required, you can accelerate the TRT_GetValues by using apre−allocated buffer. For example, if you know there are ten points in each series, you can use theUpdate10Points_St structure defined earlier.

void GetSeriesData(){Update10Points_St update;TRT_VarLen cmd;

2 Overview

29

Page 30: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

long *lptr, num_pts, first_index;double *data;

// we know there are 10 points in the series // // the required buffer is thus a structure of type Update10Points_St //

cmd.length = sizeof(Update10Points_St); // size in bytes //cmd.buffer = (void *) &update; // points to the struct //

// get the data for the first series //TRT_GetValues (TRT_cid, "my_chart",TRT_ATT_CHART_CHANGE_SERIES, 0, // the first seriesTRT_ATT_CHART_SERIES_DATA, &cmd, // cmd.buffer is filledNULL);

// interpret varlen structure //num_pts = update.num_pts;first_index = update.first_index;data = update.data;}

2.11.5 Attribute flags

It is enough to have part of the attribute name for its identification. The remaining bits are used for attributeflags to specify properties such as the data type to expect or to denote options.

The TRT_ATT_ALLOC flag, for example is used to specify that space be allocated during aTRT_GetValues call. TRT_ATT_REFRESH specifies that the object either be redrawn or not after thecompletion of the TRT_SetValues command. Normally, the default setting is the preferred option. If set, theentire object will be refreshed. If not, only the damaged part of object will be.

For example, the default setting for refresh bit is off for TRT_ATT_DRAW_MODE. But an object willrefresh itself by:

TRT_SetValues (TRT_cid, object_ID,TRT_ATT_DRAW_MODE | TRT_ATT_REFRESH, TRT_DRAW_FORCED_ONCE | TRT_DRAW_OBJECT_ONSCREEN,NULL);

2.11.6 Using TRTConst.h and other headers

Most of the information in this manual can actually be deduced from an examination of the header files.

<tilcon/TRTAPI.h> Version 4.6API functions<tilcon/TRT_API.h> Additional functions (e.g. those used in v3)<tilcon/TRTConst.h> Object and component attributes, and most macro definitions.<tilcon/TRTBaseClass.h> Basic C++ object/class definitions.

TRTConst.h has been organized in a similar fashion to this manual. The attributes for each object aregathered together, and comments indicate which components are used by that object. With many attributesyou will find definitions for the possible values for that attribute.

To find an object in TRTConst.h, search for @W and the object type,

For example, button:

2 Overview

30

Page 31: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

@WButton

To find the attributes of a component, search for @L and the component type,

For example, the scale on the button:

@Lscale

2.11.7 Using TRT_ATT_CHANGE and TRT_ATT_CURRENT

When an object contains several similar components (e.g. items in a list box, plots in a chart etc.),TRT_ATT_CHANGE_xxx and TRT_ATT_CURRENT_xxx can specify one component in particular.

This is necessary to Set/Get the attributes of that component (e.g. to set the plot type of Plot # 2 on a chart tobe a bar plot),

TRT_SetValues (TRT_cid, chart.ID, TRT_ATT_CHART_CHANGE_PLOT, 2,TRT_ATT_CHART_PLOT_TYPE, TRT_CHART_2D_BAR, NULL);

When using TRT_SetValues, TRT_ATT_CHANGE and TRT_ATT_CURRENT are interchangeable.

To query which component is the ”active” one, use

TRT_ATT_CURRENT_xxx

2.12 Compiling and linking

To help make your application easily portable, the TILCON TRTAPI library contains the code that actuallycommunicates with the TILCON Runtime. That is, the TRT functions (TRT_WindowLoad(), TRT_Exit(),etc.) are in TRTAPI. The Runtime itself is contained in trtkrnlw in MS, (trtkrnlwx in X Windows, trtkrnlwp inPhoton).

TRTAPI uses C++ commands, so plib3r.lib must be present during compilation

QNX:

cc <filename.c> −l TRTAPI −o <filename>

For Watcom compiler:

install the C++ libraries

MS:

For Watcom compiler:

wcl386 /l=nt_win <filename.c> \TE4\lib\watcom\trtapi.lib

For Microsoft Visual C++ compiler:

cl <filename.c> /link \TE4\lib\vc\trtapi.lib gdi32.lib user32.lib

2 Overview

31

Page 32: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

2.13 Sample application

Here is the skeleton of an application for use with TILCON. Communication is opened with TRT_Start, andan initial window is created and displayed. Within the main loop, TRT_GetInput waits for the Runtime toreport an event. Your application provides some form of ProcessTilconNotification function to be called whennotifications are received from the Runtime; TRT_GetInput takes care of processing callbacks.TRT_GetInput can also be set up so that messages from other processes can be received, or it can wait forsemaphores to signal events, allowing for this program to communicate with other processes. At some point,in response to some event, the program will break out of the infinite loop and call TRT_Exit, which will tellthe Runtime to terminate.

This is a very simple application that uses TRTD V4.6.

It creates a window and two buttons.

2 Overview

32

Page 33: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

on one of the buttons the window will change color.

To compile you must link this to "trtapi.lib".

#define CC_TRT_DOS // Do this so the kernel knows we are in Windows

#include <windows.h>#include <stdlib.h>#include <tilcon/TRTConst.h>#include <tilcon/TRTAPI.h>

// Function Prototypes //

void CreateGUI(pid_t TRT_pid);

// Global variables //

TRT_StartData StartData; // This structure will store info about the kernel

// Function Definitions WinMain or Main //

int WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow ){TRT_ReceiveData rec_data;long running;long looping = 0;long c;

// Start the runtime //

StartData.Display = NULL; // This flag is used for TCP/IP. Normally it is set to NULLStartData.Userprog = "tutor";StartData.AppName = "tutor";StartData.Flags = NULL; // For now set to NULLStartData.Os_Env = TRT_MS_WINDOWS; // The operating system this app is running under.running = TRT_Start ( &StartData);

// If the runtime started up okay //

if (0 == running) // − 1 an error//{ // Create the GUI //CreateGUI(StartData.TRT_CID);looping = 1;}

while (looping){

// Wait for input from the runtime. Notice TRT_BLOCK //

c = TRT_GetInput (0, 0, NULL, 0, &rec_data, TRT_BLOCK );if (c == 0){ // You can find definitions for the codes in TRTCONST.H // // The receive data structure essentially works the same as // // in version 3 //

switch (rec_data.code){

2 Overview

33

Page 34: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

// The user clicked on a button //

case TRT_button:if (0 == strcmp("button1", rec_data.ID)){

// Color the window dark blue //

TRT_SetValues(StartData.TRT_CID, "main",TRT_ATT_FILL_COLOR, 1,NULL );}else if (0 == strcmp("button2", rec_data.ID)){

// Color the window green //

TRT_SetValues(StartData.TRT_CID, "main",TRT_ATT_FILL_COLOR, 2,NULL );}

break;

// The user clicked on something else, most probably the X close button on the window //

default:looping = 0;;

break;}}}

TRT_Delete(StartData.TRT_CID, "main");TRT_Exit(StartData.TRT_CID);return 0;}

void CreateGUI (pid_t TRT_pid)

Parameters: TRT_pid: Channel ID of an object space within a tilcon runtime Returns int: Exit code Comments: Create a window and two (2) buttons.

void CreateGUI(pid_t TRT_pid){SimpleObject widget; // This structure is used to create Widgets

// Create the main window //

strcpy ( widget.Id, "main" ) ; // This is the ID of the windowstrcpy ( widget.Label, "Tutor" ) ; // This is the label that appear on the windowwidget.parent_id[0] = NULL; // The window will not have a parentwidget.Style = 0;widget.X = 0; // It will appear at 0,0widget.Y = 0;widget.Width = 320; // and be 320x240widget.Height = 240;widget.Flag = 0;

2 Overview

34

Page 35: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

TRT_SimpleCreate (TRT_pid, (long)TRT_window, &widget);

// Create a button //

strcpy ( widget.Id, "button1");strcpy ( widget.Label, "Blue");strcpy ( widget.parent_id, "main");widget.Style = 0;widget.X = 5;widget.Y = 5;widget.Width = 60;widget.Height = 40;widget.Flag = 0;

TRT_SimpleCreate (TRT_pid, (long)TRT_button, &widget );

// Make the button look a little more intresting //

TRT_SetValues(TRT_pid, "button1",TRT_ATT_HIDE,0,TRT_ATT_BORDER_LOOK3D, 0,TRT_ATT_BORDER_DEPTH3D, 2,TRT_ATT_NOTIFY, 1,NULL);

// Create another button with the same attributes //

strcpy ( widget.Id, "button2"); // All widgets require a unique IDstrcpy ( widget.Label, "Green");strcpy ( widget.parent_id, "main");widget.Style = 0;widget.X = 65;widget.Y = 5;widget.Width = 60;widget.Height = 40;widget.Flag = 0;

TRT_SimpleCreate (TRT_pid, (long)TRT_button, &widget );TRT_SetValues(TRT_pid, "button2",TRT_ATT_HIDE, 0,TRT_ATT_BORDER_LOOK3D, 0,TRT_ATT_BORDER_DEPTH3D, 2,TRT_ATT_NOTIFY,1,NULL);

// Display our Widgets //

TRT_Display(TRT_pid, "button2");TRT_Display(TRT_pid, "button1");TRT_Display(TRT_pid, "main");}

Colors

When updating the color of an object, your application must pass an appropriate value to the API function.This value can (a) be an index into the TILCON palette; (b) specify values for red, green and blue intensities;(c) be TRT_Transparent; or (d) TRT_InvertColor.

Colors

35

Page 36: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

The TILCON palette consists of 256 colors. These are the colors available in color listboxes, and in theTILCON Graphics Editor as you create windows. The red, green and blue intensities for each palette entry arelisted at the end of this section. Macro definitions are available for the first 16 colors.

To obtain a color with specific values for red, green and blue intensities, use TRT_RGB_Color orTRT_RGB. TRT_RGB_Color accepts r,g,b values from 0 to 255 and obtains a value that you can use insubsequent API functions. TRT_RGB returns the color instead of passing it as a parameter.

To set a color to transparent, use TRT_Transparent

Use TRT_InvertColor to draw objects by inverting the colors behind them.

Examples:

TRT_RGB_Color(&black,0,0,0);

White = TRT_RGB(255,255,255);

TILCON Palette Table

Macro Index R G B

TRT_BLACK 0 0 0 0

TRT_DBLUE 1 0 0 128

TRT_DGREEN 2 0 128 0

TRT_DCYAN 3 0 128 128

TRT_DRED 4 128 0 0

TRT_DMAGENTA 5 128 0 128

TRT_DYELLOW 6 128 128 0

TRT_LGRAY 7 192 192 192

TRT_DGRAY 8 128 128 128

TRT_BLUE 9 0 0 255

TRT_GREEN 10 0 255 0

TRT_CYAN 11 0 255 255

TRT_RED 12 255 0 0

TRT_MAGENTA 13 255 0 255

TRT_YELLOW 14 255 255 0

TRT_WHITE 15 255 255 255

−− 16 0 0 0

−− 17 20 20 20

−− 18 32 32 32

−− 19 44 44 44

−− 20 56 56 56

−− 21 69 69 69

−− 22 81 81 81

−− 23 97 97 97

Colors

36

Page 37: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

−− 24 113 113 113

−− 25 130 130 130

−− 26 146 146 146

−− 27 162 162 162

−− 28 182 182 182

−− 29 203 203 203

−− 30 227 227 227

−− 31 255 255 255

−− 32 0 0 255

−− 33 65 0 255

−− 34 125 0 255

−− 35 190 0 255

−− 36 255 0 255

−− 37 255 0 190

−− 38 255 0 125

−− 39 255 0 65

−− 40 255 0 0

−− 41 255 65 0

−− 42 255 125 0

−− 43 255 190 0

−− 44 255 255 0

−− 45 190 255 0

−− 46 125 255 0

−− 47 65 255 0

−− 48 0 255 0

−− 49 0 255 65

−− 50 0 255 125

−− 51 0 255 190

−− 52 0 255 255

−− 53 0 190 255

−− 54 0 125 255

−− 55 0 65 255

−− 56 125 125 255

−− 57 158 125 255

−− 58 190 125 255

−− 59 223 125 255

−− 60 255 125 255

−− 61 255 125 223

−− 62 255 125 190

−− 63 255 125 158

−− 64 255 125 125

−− 65 255 158 125

Colors

37

Page 38: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

−− 66 255 190 125

−− 67 255 223 125

−− 68 255 255 125

−− 69 223 255 125

−− 70 190 255 125

−− 71 158 255 125

−− 72 125 255 125

−− 73 125 255 158

−− 74 125 255 190

−− 75 125 255 223

−− 76 125 255 255

−− 77 125 223 255

−− 78 125 190 255

−− 79 125 158 255

−− 80 182 182 255

−− 81 199 182 255

−− 82 219 182 255

−− 83 235 182 255

−− 84 255 182 255

−− 85 255 182 235

−− 86 255 182 219

−− 87 255 182 199

−− 88 255 182 182

−− 89 255 199 182

−− 90 255 219 182

−− 91 255 235 182

−− 92 255 255 182

−− 93 235 255 182

−− 94 219 255 182

−− 95 199 255 182

−− 96 182 255 182

−− 97 182 255 199

−− 98 182 255 219

−− 99 182 255 235

−− 100 182 255 255

−− 101 182 235 255

−− 102 182 219 255

−− 103 182 199 255

−− 104 255 0 0

−− 105 230 0 0

−− 106 199 0 0

−− 107 173 0 0

Colors

38

Page 39: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

−− 108 143 0 0

−− 109 117 0 0

−− 110 87 0 0

−− 111 61 0 0

−− 112 255 94 0

−− 113 230 84 0

−− 114 199 73 0

−− 115 173 64 0

−− 116 143 52 0

−− 117 117 43 0

−− 118 87 32 0

−− 119 61 22 0

−− 120 255 191 0

−− 121 230 172 0

−− 122 199 149 0

−− 123 173 130 0

−− 124 143 107 0

−− 125 117 88 0

−− 126 87 65 0

−− 127 61 46 0

−− 128 255 255 0

−− 129 203 230 0

−− 130 176 199 0

−− 131 153 173 0

−− 132 126 143 0

−− 133 104 117 0

−− 134 77 87 0

−− 135 54 61 0

−− 136 128 255 0

−− 137 115 230 0

−− 138 99 199 0

−− 139 87 173 0

−− 140 71 143 0

−− 141 59 117 0

−− 142 43 87 0

−− 143 31 61 0

−− 144 34 255 0

−− 145 31 230 0

−− 146 27 199 0

−− 147 23 173 0

−− 148 19 143 0

−− 149 16 117 0

Colors

39

Page 40: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

−− 150 12 87 0

−− 151 8 61 0

−− 152 0 255 64

−− 153 0 230 57

−− 154 0 199 50

−− 155 0 173 43

−− 156 0 143 36

−− 157 0 117 29

−− 158 0 87 22

−− 159 0 61 15

−− 160 0 255 157

−− 161 0 230 142

−− 162 0 199 123

−− 163 0 173 107

−− 164 0 243 88

−− 165 0 117 72

−− 166 0 87 53

−− 167 0 61 38

−− 168 0 255 255

−− 169 0 230 230

−− 170 0 199 199

−− 171 0 173 173

−− 172 0 143 143

−− 173 0 117 117

−− 174 0 87 87

−− 175 0 61 61

−− 176 0 162 255

−− 177 0 145 230

−− 178 0 126 199

−− 179 0 110 173

−− 180 0 90 143

−− 181 0 74 117

−− 182 0 55 87

−− 183 0 39 61

−− 184 0 64 255

−− 185 0 57 230

−− 186 0 50 199

−− 187 0 43 173

−− 188 0 36 143

−− 189 0 29 117

−− 190 0 22 87

−− 191 0 15 61

Colors

40

Page 41: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

−− 192 30 0 255

−− 193 27 0 230

−− 194 23 0 199

−− 195 20 0 173

−− 196 17 0 143

−− 197 14 0 117

−− 198 10 0 87

−− 199 7 0 61

−− 200 128 0 255

−− 201 115 0 230

−− 202 99 0 199

−− 203 87 0 173

−− 204 71 0 143

−− 205 59 0 117

−− 206 43 0 87

−− 207 31 0 61

−− 208 221 0 255

−− 209 199 0 230

−− 210 172 0 199

−− 211 150 0 173

−− 212 124 0 143

−− 213 102 0 117

−− 214 75 0 87

−− 215 53 0 61

−− 216 255 0 191

−− 217 230 0 172

−− 218 199 0 149

−− 219 173 0 130

−− 220 143 0 107

−− 221 117 0 88

−− 222 87 0 65

−− 223 61 0 46

−− 224 255 0 98

−− 225 230 0 88

−− 226 199 0 76

−− 227 173 0 66

−− 228 143 0 55

−− 229 117 0 45

−− 230 87 0 33

−− 231 61 0 23

−− 232 255 0 0

−− 233 230 0 0

Colors

41

Page 42: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

−− 234 199 0 0

−− 235 173 0 0

−− 236 143 0 0

−− 237 117 0 0

−− 238 87 0 0

−− 239 61 0 0

−− 240 255 94 0

−− 241 230 84 0

−− 242 199 73 0

−− 243 173 64 0

−− 244 143 52 0

−− 245 117 43 0

−− 246 87 32 0

−− 247 61 22 0

−− 248 255 255 0

−− 249 230 230 0

−− 250 199 199 0

−− 251 173 173 0

−− 252 143 143 0

−− 253 117 117 0

−− 254 87 87 0

−− 255 61 61 0

Transmit Keys, Shortcut Keys

When specifying a particular keystroke, your application can use the ASCII value of the character or any ofthe following:

TRT_KEY_BACKSPACE Backspace key

TRT_KEY_TAB Tab key

TRT_KEY_ENTER Enter key

TRT_KEY_ESC ESC key

TRT_KEY_SPACE Spacebar

TRT_KEY_CAPS Caps lock key

TRT_KEY_PGUP Page up key

TRT_KEY_PGDN Page down key

TRT_KEY_END End key

TRT_KEY_HOME Home key

TRT_KEY_LEFTARROW Left arrow key

TRT_KEY_UPARROW Up arrow key

TRT_KEY_RIGHTARROWRight arrow key

TRT_KEY_DOWNARROWDown arrow key

Transmit Keys, Shortcut Keys

42

Page 43: User Guide Table of Contents - Symmetry and whitepapers... · Table of Contents − User Guide ... To create a boot disk 1. ... selected items can trigger commands or send notifications

TRT_KEY_INS Insert key

TRT_KEY_DEL Delete key

TRT_KEY_CENTER The center key on the key pad

TRT_KEY_GRAYPLUS The plus key on the key pad

TRT_KEY_GRAYMINUS The minus key on the key pad

TRT_KEY_GRAYENTER The enter key on the key pad

TRT_KEY_GRAYASTRIX The asterisk key on the key pad

TRT_KEYGRAYSLASH The slash key on the key pad

TRT_KEY_F1 The F1 function key

TRT_KEY_F2 The F2 function key

TRT_KEY_F3 The F3 function key

TRT_KEY_F4 The F4 function key

TRT_KEY_F5 The F5 function key

TRT_KEY_F6 The F6 function key

TRT_KEY_F7 The F7 function key

TRT_KEY_F8 The F8 function key

TRT_KEY_F9 The F9 function key

TRT_KEY_F10 The F10 function key

TRT_KEY_F11 The F11 function key

TRT_KEY_F12 The F12 function key

This value can be combined using the bitwise OR with any or all of the following:

TRT_KEY_CTRL The CTRL key

TRT_KEY_ALT The ALT key

TRT_KEY_SHIFTThe SHIFT key

Transmit Keys, Shortcut Keys

43