|
|
|
|
|
- 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 in the window initialization event.
- Create a Button control ("BTN_Add"). Write the WLanguage code in the "Click" event of the control.
- Create a Button control ("BTN_Stop"). Write the WLanguage code in the "Click" event of the control.
- Create and type the thread procedure.
To run the test of this example: - Show window: thread starts, nothing happens. This operating mode is normal because the thread waits if the stack is empty.
- Click on the Add button field (BTN_Add): only file traces are displayed. The end trace is not displayed.
- Click once again on the Add button field (BTN_Add): only file traces are displayed. The end trace is still not displayed.
- Click on the End button field (BTN_Stop): the end trace is displayed (thread stops).
- Click on the add button field (BTN_Ajout): nothing happens. This operating mode is normal because the thread is stopped.
ThreadExecute("test", threadNormal, FileProcesses)
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
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")
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|