PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • The HTML format
  • Edit control in HTML format
  • Overview
  • Notes:
  • Defining the content of an HTML edit control
  • Security mechanism of the HTML edit control
  • Finding out the position of the selection in an HTML edit control
  • Using the RTFxxx functions with an HTML edit control
  • Example: Apply bold formatting to the selected text
  • Saving a text in an HTML file
  • Example
  • Saving text in HTML format in an item of a HFSQL data file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The HTML format
The HTML format (HyperText Markup Language) is a tagging language intended for the Web.
WINDEV and WEBDEV allow you to handle text in RTF format via the "RTF format" option of edit controls and via the HTML control.
  • If the text in HTML format is displayed in a control that does not support the HTML format, the tags will be displayed.
  • If the text in HTML format is displayed in a control that supports the HTML format, the tags will be automatically interpreted and the text will be formatted accordingly.
Note: To use an edit control in HTML format, Microsoft Internet Explorer version 6 (or later) must be installed on the computer that runs the application.
Edit control in HTML format

Overview

An HTML edit control is used to display a text in HTML format and to enter a text in HTML format.
When typing a text in an HTML control, this text is automatically stored in HTML format by the control. This text contains all the tags required for the formatting.

Notes:

  • A formatting toolbar can be displayed above the edit control. This toolbar allows the user to easily format the text entered. See HTML formatting toolbar for more details.
  • WINDEV For the applications that operate in Windows Vista (or later) or in Tablet PC, you have the ability to include the "Handwritten input" option. This option allows the user to directly type the text in the control with the stylus or with the mouse. This feature is available by default in the applications that operate on Mobile.
  • If the same text is entered in a standard edit control and in an HTML edit control, the character string found in the HTML edit control will be longer than the string found in the standard edit control (because the HTML tags are added).
Defining the content of an HTML edit control
To define the content of an HTML edit control, all you have to do is assign ..Value by programming (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
WINDEV

Security mechanism of the HTML edit control

By default, the edit controls in HTML format include a security mechanism against spiteful code.
This mechanism is checked:
  • in the editor via "Allow the execution of scripts" ("General" tab of the control),
  • by programming with ..SecurityHtml.
If the security mechanism is enabled (option unchecked in the editor), all the active elements found in the HTML are locked by default. The active elements are:
  • The Javascript code.
  • The Java applets.
  • The plug-ins (corresponding to the <OBJECT> tags in HTML).
Note: When the ..State property of the edit control is equal to Active, the elements of the controls are in edit and all the active elements are disabled. ..SecurityHtml is useful when the value of ..State is equal to DisplayOnly or Inactive.
WINDEV

Finding out the position of the selection in an HTML edit control

To find out the position of the selection, you must use ..Cursor and ..CursorEnd.
Note: These properties return a value expressed in number of characters displayed in the control (and not in the corresponding HTML code).
WINDEV

Using the RTFxxx functions with an HTML edit control

The functions for managing the RTF controls can be used with an HTML edit control. Some specific features must be respected:
FunctionSpecific features
AddLinkThis function has no effect.
Its use triggers no error.
RTFAddThis function cannot be used on the HTML edit controls.
Its use triggers an error.
RTFLoadThis function cannot be used on the HTML edit controls.
Its use triggers an error.
RTFInsertThis function cannot be used on the HTML edit controls.
Its use triggers an error.
RTFSearchThis function cannot be used on the HTML edit controls.
Its use triggers an error.
RTFReplaceThis function cannot be used on the HTML edit controls.
Its use triggers an error.
RTFSelectionOnly the syntax used to modify the selected text is supported. The syntax taking in parameter the start position and the end position of the text to modify will trigger an error.
RTFToTextThis function returns the HTML source code.
WINDEVWindowsJava

Example: Apply bold formatting to the selected text

The following code, placed in the exit code of an edit control in HTML format, is used to apply the bold attribute to the selected text.
IF EDT_Edit1..CursorEnd > EDT_Edit1..Cursor THEN
        RTFSélection(EDT_Edit1, rtfBold, True)
END
Saving a text in an HTML file
In an HTML edit control, the text entered is automatically in HTML format.
To save the content of an edit control in HTML format in an HTML file, all you have to do is use fSaveText on the control.

Example

This example is used to create an "index.html" file. This file contains the text entered in the edit control named 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 text in HTML format in an item of a HFSQL data file

To save a text in HTML format in an item of a data file, we advise you to link the edit control to a Text Memo item.
Indeed, as the HTML format includes several tags, a "Character string" item is usually not large enough.
Related Examples:
WD Mail Complete examples (WINDEV): WD Mail
[ + ] This application is an email client developed in WINDEV. It is based on the Email objects.
This email client is used to retrieve and send emails by using the POP, IMAP and SMTP protocols.
You have the ability to apply filters to the incoming emails.

The application can also be used to manage several email accounts. The writing of an email is based on the HTML edit control.
Minimum required version
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment