Initialisation Context
Initialisation Context facilitates the process of runtime creation of DGKC control. 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 DGKC. DGKC 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 DGKC. 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 |
Background color |
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_DG interface.
To obtain
IControlInitialisationContext_DG interface obtain
IGlobalAPI_DG and use
IGlobalAPI_DG.LockInitialisationContext() method.
Call IControlInitialisationContext_DG.Activate(true)
for context to be used during control instantiation
Release the context as soon as possible with IControlInitialisationContext_DG.ReleaseContext to make it available for other threads.
See ShapeExplorer sample
|