Skip to main content

Downloading a Text List without a Visualization

Applications which contain text lists but do not have a visualization and a Visualization Manager require additional code. Only then can the texts be read from the text lists.

To initially load the texts, call the following two lines of code:

DynamicTextReloadTexts();
DynamicTextChangeLanguage( <language> );

For the string variable <language>, specify the name of the language as it has been entered in the text list. Note that string literals must be enclosed in single straight quotation marks (').

Tip

Loading the texts may take some time depending on the size of the text lists. Therefore, it should be executed in a background task, depending on the demand.

Example 5. Example

A project contains the text lists GlobalTextList, MyEnumWithTextSupport, and MyTextListA, but no visualization.

_vsprt_img_enum_no_visu_1.png
_vsprt_img_globaltexlist_no_visu_1.png
_vsprt_img_textlist_no_visu_1.png

Using the following code, the text list is read in en from MyEnumWithTextSupport.

PROGRAM PLC_PRG
VAR
    eTest:MyEnumWthTextSupport;
    sIndex: STRING:='1';
    xGetText: BOOL;
    sTextList: STRING:='MyEnumwithTextSupport';
    sTest:POINTER TO STRING;
    sText:STRING;
END_VAR
IF xGetText THEN
    sTest:=DynamicTextGetLanguageText(stLanguage:='en' , stTextList:=sTextList, stTextIndex:=sIndex );
    xGetText:=FALSE;
END_IF

IF sTest <> 0 THEN
    sText:=sTest^;
END_IF