Configuring the editing of a text file
To use the Text Editor in the user interface to create or edit a text file on the controller, you need controls for selecting, opening, closing, saving, and creating a file in addition to the Text Editor element.
Example:

Drag a Text Editor element to the visualization editor.
For example, declare the control variables for the element as global variables in the
GVLobject.For more information, see the declaration of the control variables below.
For the Text Editor, configure the property with Read/Write.
Continue configuring the property.
. Assign the following variables there::
g_sFileName:
g_bFileOpen:
g_bFileClose:
g_bFileSave:
g_FileNew
Declaration of control variables
VAR_GLOBAL
g_sFileName: STRING := 'Readme.txt';
g_bFileOpen : BOOL;
g_bFileClose: BOOL;
g_bFileSave: BOOL;
g_FileNew: BOOL;
g_usiErrorHandlingVarForErrorCode: USINT;
g_bVarForContentChanged : BOOL;
g_bVarForReadWriteMode: BOOL;
END_VAR
Add a Label element.
Configure it in the property with
File.Add a Rectangle element next to it.
Configure its property with
%s.Configure its property with
g_sFileName.Configure the property with Write Variable.
In the Input configuration dialog, select Input type as the Text input.
Select the Use text output variable option.
The box to input the file name is configured.
Add a Button element.
Configure its property with
New.Configure the property with Switch Variable.
Assign
g_bFileNewas the variable.The
Newbutton is configured.Add another Button element.
Configure the property with
Open.Configure the property with Switch Variable.
Assign
g_bFileOpenas the variable.The
Openbutton is configured.Add another Button element.
Configure its property with
Save.Configure the property with Switch Variable.
Assign
g_bFileSaveas the variable.The
Savebutton is configured.Add another Button element.
Configure its property with
Close.Configure the property with Switch Variable.
Assign
g_bEditFileas the variable.The
Closebutton is configured.