PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example for using the ..AdditionCompleted property
AdditionCompleted (Example)
Example for using the ..AdditionCompleted property
To implement this example:
  • Create a window. Type the initialization code of this window.
  • Create a "BTN_Add" button. Type the click code of this button.
  • Create a "BTN_Stop" button. Type the click code of this button.
  • 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 the addition button (BTN_Add): only the traces of the files are displayed. The end trace is not displayed.
  • Click the addition button once again (BTN_Add): only the traces of the files are displayed. The end trace is still not displayed.
  • Click the ending button (BTN_Stop): the end trace is displayed (the thread stops).
  • Click the addition button (BTN_Add): nothing happens. This operating mode is normal because the thread is stopped.
// In the initialization code of the window, start the thread only
ThreadExecute("test", threadNormal, FileProcesses)
// Addition code that must be included in the BTN_Add button (used to run the test again)
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
// Stop code that must be included in the BTN_Stop button
// (to check the moment of 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