SetModuleRefBox

(Engine-Level Function)

Description: Sets the default reference box for a module.
Warning: This statement should be used by advanced users only since irrevocable alteration of your application may occur.
Returns: Nothing
Usage: Script Only.
Function Groups: Compilation and On-Line Modifications, Graphics,  Advanced Module
Related to: GetModuleRefBox | GetXformRefBox | SetInstanceRefBox
Format: SetModuleRefBox(Module, Left, Bottom, Right, Top)
Parameters:  
Module
Required. Any expression for the object value of the module.
Left
Required. Any numeric expression for the left side of the reference box for Module's graphics.
Bottom
Required. Any numeric expression for the bottom side of the reference box for Module's graphics.
Right
Required. Any numeric expression for the right side of the reference box for Module's graphics.
Top
Required. Any numeric expression for the top side of the reference box for Module's graphics.
Comments: A module's reference box defines an area that will exactly enclose all active graphics (graphics currently displayed) in the module before any rotations and trajectories have been applied. A module reference box, or MRB as it is sometimes called, is not a clipping region and objects can and often will extend outside of their MRB as a result of applied rotations or trajectories.
When a module is transformed, the transform is based on the size of the module as determined by its reference box. If the module switches states, the active graphics will change, thereby changing the MRB for that module. The result is that the transform will change such that graphic objects will grow or shrink, so that the module's reference box will always exactly fill the reference box of the transform. In the case of graphics that have had a rotation or trajectory applied to them, the graphics will be transformed correctly, but the MRB may no longer contain the objects in their modified positions.

This statement allows the user to set the reference box of a module to a constant size, so that as graphics become active and inactive, the transform will not cause the graphic objects to grow and shrink - since the transform is based on the module's reference box, and this is now fixed, the transform will be similarly fixed.

This call should be followed by a call to SaveModule, otherwise the module reference box change will only be written when the application containing this statement is stopped (in the case of base VTScada code this means when VTScada is shut down).
Great care should be exercised when using this statement, since the module reference box for the module itself is altered, not just the instance in which the statement is called. All instances of this module will have their reference box permanently changed.

Example:

Init [
  If 1 Main;
  [
    SetModuleRefBox(Self(), 0, 599, 799, 0);
  ]
]

This sets the current module's reference box to a fixed size equal to the default window size.