Initialisation Context
Initialisation Context facilitates the process of runtime creation of DG Kernel controls. It addresses the
problem that controls are created using generic methods of a particular language
or IDE. The method is not aware of properties of DG Kernel. DG Kernel creation
process on the other hand can work quite differently depending on the
environment and requested properties.
The Initialisation Context is a global set of properties, slightly
different from the normal properties of DG Kernel. This set of properties is not
dependent on any particular instance of a control and is always accessible even
if no control has been created yet.
Initialisation Context is runtime-only functionality and is not persisted to the file system
The main property of the context is the Active property. It is false by
default. If it was set to true, any DG Kernel control will use the context
during creation to determine the type of the control requested and its initial
properties.
Properties of Initialisation Context
Property |
Description |
Type |
Default |
Active |
If true any control created at runtime will copy or use the
properties below before its creation |
Boolean |
false |
ModelPath |
Will be copied to ModelPath
of the control |
String |
Empty |
ShowGlobalAxes |
Will be copied to
ShowGlobalAxes |
Boolean |
False |
BackgroundColor |
Components of background color to be used in
DIBackColor property |
Color |
rgba(0.8, 1.0, 0.8, 1.0) |
RenderSolid |
Will be copied to
RenderSolid |
Boolean |
True |
Visible |
If false and supported by the IDE the control will be created
invisible. It is recommended to set it to false to avoid flicker on start |
Boolean |
True |
Using Initialisation Context
The context is accessed via
IControlInitialisationContext_KC interface.
To obtain
IControlInitialisationContext_KC interface obtain
IGlobalAPI_KC and use
IGlobalAPI_KC.LockInitialisationContext() method.
Call IControlInitialisationContext_KC.Activate(true)
for context
to be used during control instantiation
Release the context as soon as possible with IControlInitialisationContext_KC.ReleaseContext to make it available for other threads.
|