|
|
|
|
- WLanguage procedure executed in the main thread
- Lenguaje Procedure ejecutado en un Thread secundario
WLanguage procedure called by HWatch WLanguage procedure ("callback") called by HWatch when a change is made on the specified data file.
HWatch(Commande, TraiteCommande, hRecNumAll, hsAdd)
PROCEDURE TraiteCommande(NomFic, NumEnreg, Action)
IF BitwiseAND(nAction, hsAdd) = hsAdd THEN
Trace("Un ajout a été effectué dans le fichier de données: " + NomFic)
END
Sintaxis
HWatch_Callback(<Modified data file> , <Record number> , <Action>)
<Modified data file>: Character string Name of the modified HFSQL data file. <Record number>: Integer Number of the modified record (equivalent to the number returned by HRecNum). <Action>: Integer constant Action that triggered the procedure. The possible values are:
| | hsAdd | Procedure started once a record is added into the data file. | hsCross | Procedure started once a record is crossed in the data file. | hsDeletion | Procedure started once a record is deleted from the data file. | hsModification | Procedure started once a record is modified in the data file. |
Caution: If a process adds a record modifies this record immediately after, HWatch is called once with a combination of the constants hsAdd and hsModification. To identify these actions in Procedure WLanguage, you need to use the BitwiseAND function. . For example:
IF BitwiseAND(nAction, hsAdd) = hsAdd THEN ...
Observaciones WLanguage procedure executed in the main thread By default, this WLanguage procedure is called in the main thread of the application, with the HFSQL context that corresponds to the procedure: - If the procedure is a local procedure of a window that uses an independent context, the context of the window will be used.
- If the procedure belongs to a component that uses an independent context, the context of the component will be used.
| Caution: The procedure associated with HWatch can be called at any time in the application. If the procedure reads records or moves between records in the data files, this will have an impact on the application (like the timers). Therefore, you may have to call HSavePosition and HRestorePosition to save the contexts of files used.Multitask must not be used in the procedure code. |
Lenguaje Procedure ejecutado en un Thread secundario Si se llama al lenguaje WL Procedure en un Thread secundario : - el contexto HFSQL se copia la primera vez que se llama a WLanguage procedure called by HWatch. Solo se almacenan los directorios que contienen los archivos de datos en modo HFSQL Classic y/o las conexiones en modo HFSQL Client/Server.
- Los elementos de la interfaz de usuario (ventanas, controles, etc.) no pueden ser manipulados en la Thread secundaria . Cuando un thread secundario debe interactuar con el usuario o actualizar la interfaz de usuario, debe utilizar un Process iniciado desde el thread principal. . Este proceso puede corresponder a:
- un procedimiento global del proyecto o un procedimiento local (de una ventana, etc.) llamado con la función ExecuteMainThread,
- el evento "Solicitud para actualizar la visualización" de una ventana, ejecutado con la función RequestRefreshUI.
Clasificación Lógica de negocio / UI: Código neutro
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|