AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Administrar bases de datos / HFSQL / Funciones HFSQL Client/Server / Procedimiento WLanguage
  • WLanguage procedure executed in the main thread
  • WLanguage procedure executed in a secondary thread
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
WLanguage procedure called by HTrack
WLanguage procedure ("callback") called by HTrack when a change is made on the specified data file.
Example
// Starts tracking the Order data file
// The ProcessOrder procedure is called whenever a record is added to the data file
HTrack(Order, ProcessOrder, hRecNumAll, hsAdd)

PROCEDURE ProcessOrder(FileName, RecNum, Action)
IF BitwiseAND(nAction, hsAdd) = hsAdd THEN
Trace("An addition was made in the data file: " + FileName)
END
Syntax
HTrack_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:
hsAddProcedure started once a record is added into the data file.
hsCrossProcedure started once a record is crossed in the data file.
hsDeletionProcedure started once a record is deleted from the data file.
hsModificationProcedure started once a record is modified in the data file.

Caution: If a process adds a record modifies this record immediately after, HTrack is called once with a combination of the constants hsAdd and hsModification.
BitwiseAND must be used to identify these actions in the WLanguage procedure. For example:
IF BitwiseAND(nAction, hsAdd) = hsAdd THEN ...
Remarks

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 HTrack 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.

WLanguage procedure executed in a secondary thread

If the WLanguage procedure is called in a secondary thread:
  • the HFSQL context is copied the first time WLanguage procedure called by HTrack is called. Only the directories containing the data files in HFSQL Classic mode and/or the connections in HFSQL Client/Server mode are stored.
  • UI elements (windows, controls, etc.) cannot be manipulated in the secondary thread. When a secondary thread must interact with the user or update the UI, it must use a process started from the main thread. This process can correspond to:
    • a global procedure of the project or a local procedure (of a window, etc.) called by ExecuteMainThread,
    • the "Request for refreshing the display" event of a window run by RequestRefreshUI.
Business / UI classification: Neutral code
Component: wd290hf.dll
Versión mínima requerida
  • Versión 22
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 17/01/2024

Señalar un error o enviar una sugerencia | Ayuda local