|
|
|
|
- WLanguage procedure executed in the main thread
- WLanguage procedure executed in a secondary thread
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
Syntax
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 ...
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 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. |
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 HWatch is called. Only the directories containing the data files in HFSQL Classic mode and/or the connections in HFSQL Client/Server mode are stored.
Remark: If HChangeDir is called between two calls to the WLanguage procedure called by HWatch function, HChangeDir is ignored. Example:
HWatch(AFile, hSecondaryThread)
HChangeDir(AnotherFile)
HWatch(AnotherFile, hSecondaryThread)
- 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
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|