ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV 2024 feature!
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Code editor control
  • Overview
  • Manipulating Code Editor controls programmatically
  • Initializing the Code Editor control
  • Allowing and disallowing functions in the Code editor control
  • Making a selection in the Code editor control
  • Undo / Redo support
  • Properties specific to Code Editor controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Manipulating Code Editor controls programmatically
Overview
WINDEV offers various Code Editor control functions to manipulate Code Editor controls programmatically.
This help page explains how to manipulate a Code Editor control programmatically.
Manipulating Code Editor controls programmatically
To manipulate a Code Editor control programmatically, simply use the variable that represents the control directly in the code.
The variable that represents the Code Editor control is the name of the control.

Initializing the Code Editor control

To assign WLanguage code to the Code Editor control programmatically, you can:
  • directly assign a multiline string. For example:
    CODEEDT_Example = [
    Res is string
    StringToConvert is string = "Crème brûlée"
    Res = AnsiToOem(StringToConvert)
    Info(Res)
    ]
  • use the CodeEditorLoad function. This function loads WLanguage code from a file.

Allowing and disallowing functions in the Code editor control

The Compiler property gets and sets the compiler options in the Code Editor control, in particular, which functions are allowed or disallowed.
In the following example, all WLanguage functions are allowed, except fDelete:
CODEEDT_Example.Compiler.AllowedFunctions = AllFunctions
CODEEDT_Example.Compiler.ForbiddenFunctions = "fDelete"

Making a selection in the Code editor control

The Cursor and CursorEnd properties can be used to make a simple selection in the Code Editor control.

Undo / Redo support

You can implement the Undo/Redo functionality in the Code Editor control using AAFExecute with the aafUndo and aafRedo constants.
Example:
AAFExecute(CODEEDT_MyCode, aafUndo)
AAFExecute(CODEEDT_MyCode, aafRedo)
Properties specific to Code Editor controls
The following properties are used to manipulate Code Editor controls programmatically.
New in version 2024
Compiler
The Compiler property gets and sets the compiler options in the Code Editor control, in particular, which functions are allowed or disallowed.
New in version 2024
LineCursor
The LineCursor property gets and sets the number of the line where the cursor is located in a Code Editor control.
For a complete list of WLanguage properties that can be used with Code Editor controls, see Code Editor control properties.
Minimum version required
  • Version 2024
Comments
Click [Add] to post a comment

Last update: 03/07/2024

Send a report | Local help