Runtime Information and Resources (Magic xpa 3.x)
At runtime each task has a defined range of resources and runtime information that it can use. The term Runtime resources refers to variables and I/O devices. Runtime information refers to all information that can be queried about each active task in the runtime task tree, about the variables, or about the defined I/O devices. A task can refer to and use resources and task information that is not necessarily available during development but is available at runtime.
You can refer to the variables of all the active runtime tree tasks using their indexed location or name. You can use various functions that query or handle the application variables to refer to all the active task variables. The available variable-related functions are: VarAttr, VarDbName VarCurr, VarCurrN, VarIndex, VarMod, VarName, VarPic, VarPrev, and VarSet.
The Cascading Program Calls example in the figure below shows each program as an independent task in development mode, with the task variables coded as A and B. At runtime the Program A and Program B variables are accessible from Program C. You can refer to the variables by their runtime order, or by the variables’ names. In the figure below, Prog A calls Prog B, which calls Prog C.
You can use I/O devices defined in programs that are not visible to each other in development mode, and you can output or input forms to a program I/O active at runtime, in other words, a program that is part of the runtime tree.
You can output or input forms to an I/O of an active ancestor task by setting the I/O name to use property of the I/O entry in the current task. This specifies the already opened ancestor task I/O device by its name. For more information, refer to the explanation of the I/O name to use property in the Reference Guide in the Magic xpa Help.
When programs call other programs and subtasks, a task tree is formed in runtime. This is a single-branched tree that begins with the top program and goes through the series of called tasks to the last running task. The last active task can query its ancestor tasks in the runtime tree using a set of functions. The functions are directed to a specific task in the runtime tree by specifying the Task Generation. The Task Generation is a sequential number defined by the task location in the runtime tree, where the generation of the lowest task is 0, the generation of its direct ancestor task is 1, and so on up the tree.
In the Cascading Program Calls example shown above, the generation of Program A is 2, Program B is 1, and the generation of Program C is 0.