The Runtime Task Tree (Magic xpa 4.x)
What is the runtime tree? Where does the current task fit in the global task tree?
When programs call other programs or tasks, a task tree is formed in runtime. This tree begins with the main program, which is the first program to run, and continues until the current program. A running task can query certain values of any ancestor task in the tree by using a set of predefined functions. You can direct a function to a specific task in the tree by specifying its generation, a sequential number defined by its location in the task tree. The bottom of the tree, the last task to be called, is generation 0, the parent of that task is generation 1, and so forth.
In a Magic xpa application without components, Program A calls Program B, as shown in the figure below.
The runtime task tree in this case is:
Main Program > Program A > Program B
If you query the task tree in Program B, you find that Program B is generation 0; Program A is generation 1; Main Program is generation 2. What happens when the called program is in a component, as shown in the figure below.
Here the component’s main program may complicate matters. How will it fit into the global scope of things? In this case, the runtime task tree is:
Main Program > Program A > Component Main Program > Program C
If you query the task tree in Program C, you find that Program C is generation 0; Program A is generation 1; Main Program is generation 2. The main program of the component is not included in the generations.