Skip to content

ViSi-Genie: Labels, Texts, and Strings

Description

This Application Note explores the possibilities provided by ViSi-Genie for the Labels objects:

Label

This application note requires:

  • Workshop4 has been installed as discussed here;
  • The user is familiar with the Workshop4 environment and with the fundamentals of ViSi-Genie, as described in Workshop4 User Guide and ViSi-Genie User Guide;
  • When downloading an application note, a list of recommended application notes is shown. It is assumed that the user has read or has a working knowledge of the topics discussed in these recommended application notes

Note

Three ViSi-Genie projects are provided as examples to help you along this application note.

Downloadable Resources

The following are the sample project files:

Genie Projects

Application Overview

It is often difficult to design a graphical display without being able to see the immediate results of the application code. ViSi-Genie is the perfect software tool that allows the user to see the instant results of their desired graphical layout with this large selection of gauges and meters that can simply be dragged and dropped onto the simulated module display.

  • Label Label
  • Static Text Static Text
  • Strings Strings

Each object can have properties edited and at the click of a button, all relevant code is produced in the user program. Each feature of ViSi-Genie will be outlined with examples below.

Setup Procedure

This application note comes with a zip file which contains three ViSi-Genie projects.

Setup Procedure

For instructions on how to launch Workshop 4, how to open a ViSi-Genie project, and how to change the target display, kindly refer to the section Setup Procedure of the application note:

Create a New Project

For instructions on how to create a new ViSi-Genie project, please refer to the section Create a New Project of the application note

Simulation Procedure

Select the Home menu to display the objects:

Home

The Labels objects are located on the Labels pane:

Label

To add an object, first click on the desired icon, here start with the first one, the Label Label and then click on the WYSIWYG screen to place it.

Screen

Label Options

You can load the example project file: 4D-AN-00013 – Labels, from the zip file located at the Downloadable Resources section or follow the procedures described hereafter.

The options are listed on the Object Inspector:

Object Inspector

The Label object has no event.

Object Inspector

Font Options

Three fonts are available: small FONT1, medium FONT2 and large FONT3. Those fonts are provided by the screen module.

Font

The font can be set to bold, italic, underline, inverse, opaque.

Font

Colour Options

Front colour and background colour can be selected. Set Opaque to yes to display the background colour. Set Inverse to yes to switch the front and background colours.

Colour Options

Colour Options

Colour Options

Colour Options

Magnification Options

The font can be adjusted both vertically and horizontally. By default, magnification is 1 on both axes.

Magnification Options

Magnification Options

Magnification Options

Magnification Options

StaticText Options

You can load the example project file: 4D-AN-00013 – StaticText, from the zip file located at the Downloadable Resources section or follow the procedures described hereafter.

To add a StaticText object, select the Labels pane

Label

click on the StaticText icon Text and then click on the WYSIWYG screen to place it:

Static Text

Enter the text on the Caption field:

Caption

Use \n for line-feed.

The options are listed on the Object Inspector:

Object Inspector

The StaticText object has no event.

Object Inspector

Font Options

The fonts used by the StaticText object include all the fonts from Windows.

Font Options

Click on the Font Options symbol on the right

Font Options

to display the Font window.

The Font window will open.

Font Window

Select the font and change the size. Choose Tahoma as font and 12 as size

Font Window

to obtain the following result:

Screen

Auto-Size Option

By default, the auto-size option is set to Yes.

AutoSize

When auto-size is activated, the size of the static-text object is automatically adjusted for the text.

Setting AutoSize to No allows using the mouse to change the width and height of the static text object.

AutoSize

Click on the red dotted line and resize the object. The text is then automatically reformatted.

Screen

Word-Wrap Option

The word-wrap option automatically includes carriage returns.

Wordwrap

Wordwrap

Wordwrap

Wordwrap

To fit the text on the screen, either

  • Adjust the Width and the Height of the StaticText object manually if AutoSize is on, or
  • Set AutoSize to no and use the mouse:

Height

Height

Height

Height

Strings Options

You can load the example project file: 4D-AN-00013 – String, from the zip file located at the Downloadable Resources section or follow the procedures described hereafter.

To add a String object, select the Labels pane

Label

click on the Strings icon Strings and then click on the WYSIWYG screen to place it:

Screen

Predefined and Dynamic Strings

The area enclosed by the box can be thought of as the "container" or the "place holder" for that strings object. The text or string displayed inside this container can be classified into two – predefined strings and dynamic strings.

Predefined strings are those that are created in Workshop during design time. These are actually saved into the uSD card and can later be retrieved during runtime. Dynamic strings, on the other hand, are those that are sent by a host to the display during runtime. A strings object (or container) can display a predefined string and a dynamic string, one at a time. There are separate commands for these.

Predefined strings can be further classified by how they are displayed – message style and book style. For message style, the user creates a text composed of multiple parts (usually a part is composed of a line). During runtime, the strings object or container can be made to display the desired line. For book style, the user creates a text composed of multiple pages.

During runtime, the strings container can be made to display the desired page. Displaying of message and book style strings will now be illustrated. Displaying of dynamic strings will be illustrated in the section "Debugger Output".

The options for a strings object are listed on the Object Inspector:

Object

The object is empty. To enter the text, select the line

String

and click on the String

A new window opens the String Editor

String Editor

Message Style Option

On the Strings Editor, select the Message option:

String Style

Enter each message, one message per line.

String Editor

The messages can be monitored on the right part of the String Editor by using the arrows:

Arrow

Arrow

Each message is displayed separately:

First Message

The background and foreground colours can also be changed.

Object Inspector

Book Style Option

Create a strings object similar to Strings0 above. On the Strings Editor, select the Book option this time:

String Style

A book includes pages, each page with multiples lines:

Book

All the lines from the same page are displayed together:

Line

The background and foreground colours can also be changed.

Background

Font Options

The font options offer a wide range of fonts, and include the fonts provided by the screen module and the fonts provided by Windows.

Font Options

Attributes can be set, as the type ANSI or UNICODE:

Object Attributes

With static text objects added as labels and the background and foreground colours changed, the final output is shown below.

MS

Build and Upload the Project

For instructions on how to build and upload a ViSi-Genie project to the target display, please refer to the section Build and Upload the Project of the application note

The uLCD-32PTU and/or the uLCD-35DT display modules are commonly used as examples, but the procedure is the same for other displays.

Debugger Output

The GTX tool is used to send and receive messages to and from the display. It is an essential debugging tool.

Launch the Debugger

To launch the Genie Test Executor or GTX, select the Tools menu

Genie Test Excecutor

and then click on the GTX GTX button

A new screen appears, with the form and objects we have defined previously, here from the Strings example:

Genie test executor

Use the Debugger

The debugger window provides all the controls for the strings object

Active Form

Display a Predefined String

To display the second message for Strings0 (message style) and to display the second page for Strings1, enter the value "1" into both fields as shown below and press on the "Set" buttons.

Active Form

The appropriate line and page are now displayed.

MS 1

The right part of the GTX window displays the command sent and the acknowledgement 06:

Set Strings Value 16:15:14.153 [01 11 00 00 01 11]
ACK 16:15:14.209 [06]
Set Strings Value 16:15:14.827 [01 11 01 00 01 10]
ACK 16:15:14.889 [06]

Send and Display a Dynamic String

To send a dynamic string to the strings object String0, click on its "Send" button. A new Send Text window asks for the text to be sent

Send text

Type the text in

Send text

and press OK. The screen is updated accordingly:

MS 1

This new message doesn’t alter the recorded messages or the predefined strings. The right part of the GTX window displays the command sent and the acknowledgement 06:

Set Strings Value 16:15:14.153 [01 11 00 00 01 11]
ACK 16:15:14.209 [06]
Set Strings Value 16:15:14.827 [01 11 01 00 01 10]
ACK 16:15:14.889 [06]
Set String Text Value 16:17:57.846 [02 00 OB 4E 65 77 20 6D 65 73 73 61 67 65 1E]
ACK 16:17:57.877 [06]

Note the difference between the command for displaying a predefined string and that for displaying a dynamic string. Refer to the Commands and Parameters section of the ViSi-Genie Reference Manual for the commands used in the examaple above.

The behavior of a Strings object is discussed in the Strings section of the ViSi-Genie Reference Manual.

As discussed in the manual, the right -, centre -, or left - alignment of a predefined string when being formatted in the strings editor in Workshop does not apply to dynamic strings. Furthermore, a dynamic string does not automatically fit into the area defined by the strings container object. It will only be printed starting at the x and y coordinates of the strings container object. Formatting of predefined strings is set during design time, while formatting of dynamic strings is up to the host.

Another important point to consider is that when the program navigates between forms, a strings object on a certain form "remembers" the last predefined line or page of text it was made to display. However, if the string object is made to display a dynamic string and form navigation occurs, the string object will not remember anything. The host or program will have to make the strings object display another line or page of predefined text. The strings object will then remember this line or page, until the next dynamic string is received.