ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Controls: Available types / HTML Display control
  • Overview
  • Default events
  • Events supported by WINDEV and WINDEV Mobile
  • Optional events
  • Optional event: Page loading error
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
HTML Display control processes
Overview
WINDEV and WINDEV Mobile include different WLanguage events associated with HTML Display Controls.
Default events

Events supported by WINDEV and WINDEV Mobile

The following events appear by default in the code editor:
EventRuntime condition
InitializationExecuted when the window is opened. *
Click on a linkExecuted when a link is clicked in the HTML Display control. Only external links (to another page) trigger this event. Internal links (to an anchor in the same page, for example) do not trigger this event.
This event accepts parameters:
PROCEDURE ClicLien(sUrl is string, bDansNouvelleFenetre is boolean, 
sDestination is string)
where <sURL> is an optional string that contains the URL of the link clicked in the HTML Display control.
If this event returns False, the action associated with the link will not be performed.
Caution: the code must not contain slow processes or processes that allow the control to regain focus. In this case, the default action will still be performed.
Android Remarks:
  • The code in the "Click on link" event must not execute a blocking process (e.g. display a dialog box).
  • This event is only available for Android 7.0 (Nougat) and higher.
    Reminder: To determine the version of Android the application is running on, use SysAndroidVersion.
  • This event will not be called if the clicked link corresponds to an anchor link in the page.
  • The event is called only when the user clicks the link. A "simulated" click from JavaScript code, for example, will not trigger the event.
Code example:
// Ouverture des liens ayant comme destination une nouvelle fenêtre,
// dans une autre fenêtre spécifique de l'application
PROCEDURE ClicLien(sUrl is string, bDansNouvelleFenetre is boolean, 
sDestination is string)
IF bDansNouvelleFenetre THEN
// Ouverture d'une autre fenêtre demandée :
// traitement d'ouverture de l'autre fenêtre,
// décalé de façon à ce que le traitement courant réponde
// avant l'ouverture de la nouvelle fenêtre
AfficheNouveauNavigateur(sUrl)
RETURN False // Annule le comportement par défaut
ELSE
RETURN True // Laisse le comportement par défaut
END

INTERNAL PROCEDURE AfficheNouveauNavigateur(sParamUrl) <delay=10ms> 
// Important : mettre un délai même minime
<COMPILE IF TypeConfiguration = Android OR  TypeConfiguration = iOS>
OpenMobileWindow(FEN_POPUP, sParamUrl) 
<ELSE>
OpenChild(FEN_POPUP, sParamUrl) 
<END>
END
Before loading the HTML pageExecuted before loading the HTML document in the HTML Display control. If the user navigates using links in the HTML Display control, this event is executed before each HTML document is loaded.
This event accepts parameters:
PROCEDURE ChangePage(sUrl is string, sDestination is string)
where <sURL> is an optional string that contains the URL of the page to be displayed.
If this event returns False, the page will not load.
After loading the HTML pageExecuted after the HTML document has been loaded in the HTML Display control. If the user navigates using links in the HTML Display control, this event is executed after each HTML document has been loaded.
Load resourcesAllows you to be notified and prevent application scripts or images from being loaded (for security purposes, for example).
This event accepts parameters:
PROCEDURE ChargementRessources(sUrl is string, nType is int)
where:
  • <sURL> is a string that corresponds to the URL of the resource to be loaded.
  • <nType> is a constant used to identify the type of resource to be downloaded:
    • typehtmlImageRes: the resource to download is an image.
    • typehtmlScriptRes: the resource to download is a script.
    • typehtmlCssRes: the resource to download is a CSS style.
    • typehtmlXMLHttpRequestRes: the resource to download is an XML document generated as response to an HTTP request.
    • typehtmlOther: the resource to download is of an unknown type.
If this event returns False, the resource will not be loaded.
Right click on a link Executed when the user right-clicks a link (to open a context menu). This event has the following format:
PROCEDURE ClicDroitLien(sUrl is string)
where <sURL> is a string that contains the URL of the link.

(*) By default, the "Initialization" event of each control is executed according to the order in which the controls were created in the window. To change this order of execution:
  1. On the "Window" tab, in the "Order" group, click "Initialization".
  2. In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
Optional events
WINDEVAndroidiPhone/iPad Several optional events can be added. To add an optional event:
  1. Select the desired control.
  2. Display the code window of this control (F2 key).
  3. Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
  4. All the optional events available for the control are displayed.
  5. Check the optional event to add and validate.
    Remark: You can select several optional events.
  6. The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete.
Remark: If the disabled code contains WLanguage code, this code is automatically deleted.
For example, you can use the following events:
  • the mouse hover over the control,
  • left mouse button down, up, double click,
  • right mouse button down, up, double click,
  • mouse wheel, etc.
New in version 2024

Optional event: Page loading error

The optional "Page loading error" event is executed when an error is detected when loading a page in the control. This event provides details of the error encountered:
PROCEDURE ErreurChargement(sUrl is string, sErreur is string, nCodeErreur is int)
where:
  • <sURL> is a string that corresponds to the URL of the resource to be loaded.
  • is a string containing the error message.
  • is an integer Receiver corresponding to the error code.
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 02/21/2024

Send a report | Local help