VtAddWorkProc(VTCL)

VtAddWorkProc(VTCL)


VtAddWorkProc -- add a working procedure

Syntax

VtAddWorkProc cmd

Description

Adds a working procedure. Returns an identifier for the working procedure that is required by VtRemoveWorkProc if you subsequently remove it. A working procedure is called whenever the application is sitting idle. After the working procedure is called, control goes back to the main loop. If there are still no events in the queue, the working procedure is called again, and is repeatedly called whenever there are no other events happening (such as buttons being pressed, text being entered, and so on). If more than one working procedure is added via subsequent calls to VtAddWorkProc, then they are called one at a time, in a round robin.

A common use for working procedures is when the application needs to do some work that the user can cancel out of. The working procedure would do its work in short time-slices, keeping track of its state. Consequently, if the user cancels the operation, cleanup can be done that is dependent on the value of the state variables.