ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Edit control
  • The HTML format
  • HTML Edit control
  • Overview
  • Control characteristics
  • WLanguage events associated with the control
  • Defining the content of an HTML Edit control
  • Saving a text in an HTML file
  • Example
  • Saving HTML text to an HFSQL data file item
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
The HTML format
HyperText Markup Language (HTML) is a markup language intended for the web.
WEBDEV allows you to handle text in HTML via the "HTML format" option of the Edit controls and the HTML control.
  • If the HTML text is displayed in a control that does not support HTML, the tags will be displayed.
  • If the HTML text is displayed in a control that supports HTML, the tags will be automatically interpreted and the text will be formatted accordingly.
HTML Edit control

Overview

The HTML Edit control is used to:
  • display HTML content,
  • enter HTML content.
The control automatically stores entered text as HTML. This text will contain all the necessary formatting tags.

Control characteristics

The HTML Edit control has several options ("General" tab in the description window):
  • HTML toolbar: A formatting toolbar can be displayed above the Edit control. This toolbar allows the user to easily format the text entered. For more details, see HTML formatting toolbar.
  • Action on Enter key: Defines what the Enter key does in the HTML Edit control.
  • Email editing: Enables an "email" input mode that limits the HTML functionalities to those recognized by most email clients.
  • Content independent of page style: Applies the style only to the the input field. No other style will be applied to the text in the input field.
Remark: A given string will be longer in an HTML Edit control than in a standard Edit control, because HTML tags are added.

WLanguage events associated with the control

The HTML Edit control includes all the WLanguage events associated with Edit controls. For more details, see Events associated with Edit controls.
The optional "Key pushed" event, available in browser code, allows you to create shortcuts using F keys, etc.
Defining the content of an HTML Edit control
To define the content of an HTML Edit control, simply specify the Value property (in the initialization code of the control, for example).
For example:
// Read an HTML file
HTMLPage is string
HTMLPage = fLoadText(SysDir(srMyDocuments) + ["\"] + "index.html")
 
// Initialize the edit control
EDT_HTMLControl = HTMLPage
Saving a text in an HTML file
HTML formatting is automatically applied to the text entered in an HTML Edit control.
To save the content of an HTML Edit control to an HTML file, simply use fSaveText on the control.

Example

The example below creates an "index.html" file. This file contains the text entered in EDT_HTMLText.
// Select the path and name of the file
FileName is string
FileName = fSelect("", "", "Select a file...", ...
"HTML files" + TAB + "*.html" + CR + "All files (*.*)" + TAB + "*.*", ...
"HTML", fselCreate + fselExist)
 
// Backup
fSaveText(FileName, EDT_HTMLText)

Saving HTML text to an HFSQL data file item

To save HTML text to an item of a data file, it is recommended to bind the Edit control to a Text Memo item.
As HTML includes many tags, "Character string" items are often too small.
Minimum version required
  • Version 15
Comments
Click [Add] to post a comment

Last update: 06/12/2023

Send a report | Local help