ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage properties / Various properties
  • Usage example of the AdditionCompleted property
AdditionCompleted (Example)
Usage example of the AdditionCompleted property
To implement this example:
  • Create a window. Enter the WLanguage code associated with the "Initializing" event in this window.
  • Create a Button control ("BTN_Add"). Write the WLanguage code corresponding to the "Click" event in this control.
  • Create a Button control ("BTN_Stop"). Write the WLanguage code corresponding to the "Click" event in this control.
  • Create and type the thread procedure.
To run the test of this example:
  • Display the window: the thread starts, nothing happens. This operating mode is normal because the thread waits if the stack is empty.
  • Click on BTN_Add: only the traces of the files are displayed. The end trace is not displayed.
  • Click again on BTN_Add: only the traces of the files are displayed. The end trace is still not displayed.
  • Click on BTN_Stop: the end trace is displayed (the thread stops).
  • Click on BTN_Add: nothing happens. This operating mode is normal because the thread is stopped.
// --"Initializing" event of the window
// In the initialization code of the window, start the thread only
ThreadExecute("test", threadNormal, FileProcesses)
// -- "Click" event on the Button control BTN_Add
// Addition code (used to restart the test)
sFileList is string = fListFile("c:\temp\*.*", frNotRecursive)
stAFile is STFile
gFilesnames.AdditionCompleted = False
FOR EACH STRING sAFile OF sFileList SEPARATED BY CR
stAFile.sPath = sAFile
stAFile.sFileName = fExtractPath(sAFile, fFileName + fExtension)
Push(gFilesnames, stAFile)
END
// -- "Click" event on the Button control BTN_Stop
// Stop code (to control the stop in the example)
gFilesnames.AdditionCompleted = True
// Procedure of the thread (with a trace at the end)
PROCEDURE FileProcesses()
stTemp is STFile
tt is boolean

tt = Pop(gFilesnames, stTemp, WaitIfEmpty)
WHILE tt
Trace(stTemp.sFileName)
tt = Pop(gFilesnames, stTemp, WaitIfEmpty)
END
Trace("end")
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help