Working with Texts

 

Documentation home

 

Introduction. 1

Maintaining Texts 1

Adding and maintaining individual form and component texts 1

Maintaining/Translating all form and component texts 3

Maintaining Shared Texts 5

Maintaining System Texts 5

HTML Content 5

Texts Programming. 5

Subtituting runtime values into texts 5

Changing texts dynamically. 5

Via control property. 5

Via Set Text command. 6

Reading Texts 6

 

See also: Shared Texts, System Texts, Text Control.

Introduction

Texts are used throughout the Ebase system. All texts have the following characteristics:

 

There are three types of texts

 

Maintaining Texts

Adding and maintaining individual form and component texts

Many controls have their own embedded texts e.g. a Group Panel control has a group header text, a Button Control has a button text etc. In addition, you can add a text at any point by inserting a Text Control which displays the texts dialog shown below.

 

Texts can be maintained in a number of ways:

 

 

Language: Select the text language from the dropdown which shows all supported languages

 

Contains HTML: indicates that the text contains formatting HTML or XHTML. See HTML Content for further information.

 

Text Reference: this shows the unique text id that is being used. Click the Change button to use a different text. This presents the dialog shown below which allows you to choose any existing text from the form or component (a local text) or any shared text. To use a shared text, select Shared from the Text namespace dropdown.

 

 

Maintaining/Translating all form and component texts

Individual texts can be translated using the Texts Dialog shown above. However, to translate texts for an entire form/component, it is much easier to use the Text Maintenance Dialog shown below which shows all texts for the form/component. To add texts for a new language, select both an existing language and the new language; for ease of translation, each text is displayed with the existing text adjacent to the new text. The Text Maintenance Dialog is accessed by clicking the  icon on the form/component toolbar.

 

 

 

All texts tab: shows all texts

Texts by Area tab: Shows texts page by page. Within this display, form level texts are shown in the Form tab and texts which are not displayed anywhere are shown on the Others tab.

 

To display a larger input box for each text, right click over the text and select Expand or double-click on the Type or Language column.

 

The following additional functionality is available only from the All Texts tab:

 

Create new text: click this button to create a new text.

Delete text: click this button to delete all selected texts. Only unreferenced texts can be deleted.

Change a text id: double click on the id, then change as required.

Show References: right click on a text and select References.

Cut/Copy/paste texts: you can copy/paste texts within a form, between forms or components and can also paste shared texts or copy form/component texts to shared texts. Texts can be cut and copied from any of the panels in the above dialog. Whan pasting, the All Texts tab is automatically displayed so the pasted texts can be seen. Texts are automatically renamed when a text with the same id already exists in the target form; this is done by adding an underscore and a number to the text id.

 

Maintaining Shared Texts

See shared texts.

Maintaining System Texts

See system texts.

HTML Content

WARNING: the system renders the page as XHTML in the WYSIWYG View, and not all HTML content is considered valid within the XHTML standard. This can sometimes cause unexpected results when HTML content is added to a page. Click here for further information.

 

Texts Programming

Subtituting runtime values into texts

Each text can contain any number of variables to be substituted dynamically at runtime with the values of one or more form fields. Each such variable must start with &&, followed by the form field name. For example, form text:

 

Department &&DEPT, expenditure for &&YEAR

 

is displayed as:

 

Department Personnel, expenditure for 2005

 

if field DEPT has value 'Personnel' and field YEAR has value '2005'.

 

A field name can be delimited by any character which cannot appear in a field name e.g. a space or comma are fine, but a hyphen and underscore will not work as these are treated as part of the field name. Field name variables can also be specified as &&{VAR1} e.g. &&{DEPT}; if this syntax is used, it does not matter which character follows the variable. Environment variable names can also be used.

 

Changing texts dynamically

Texts can be changed dynamically at runtime in two ways. These changes are temporary and last only to the end of the form execution.

 

Via text property of controls and fields

When a text is configured as a property of a control or a field, it can be changed as shown below. Field texts cannot be changed using FPL.

 

FPL:

API based language (Javascript):

 

// change text of Text Control

set TEXT12.text = 'any new text';

 

 

// change text of Text Control

controls.TEXT12.text.text = "any new text";

// change field label text

fields.FIELD1.labelText.text = "any new text";

 

 

See the documentation on each control for a list of property names.

 

Via Set Text command

This is only currently supported by FPL and there is no equivalent for API based languages.

The set text FPL command changes a text using its id. The difference between this method and the control property method is that the set text command changes the text in the text pool, therefore the text will be changed in all locations where it is referenced.

 

There are two supported syntaxes:

 

set text textid = 'any new text';

e.g.

set text TXT14 = 'Your answer is not clear - please provide additional details';

 

or..

 

set textid1 = textid2;

e.g.

set text TXT14 = TXT29;

 

Reading Texts

This is only currently supported by FPL and there is no equivalent for API based languages.

A text can be read using the gettext() function. This can read a text of any type (component/form, shared or system) and in any language e.g.

 

set temptext = gettext('TXT1');

set temptext = gettext('SHR11', 'Shared', 'EN');

 

Click here for details.