Home Page > KernelCAD Components > Initialisation Context
Initialisation Context
Initialisation Context of KernelCAD Components
KernelCAD controls can be created dynamically at runtime. The Initialisation
Context facilitates the process of runtime control creation. 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 KernelCAD. KernelCAD creation
process on the other hand can work quite differently depending on the
environment and requested properties.
The Initialisation Context is a single global set of properties, slightly
different from the normal properties of KernelCAD. This set of properties is not
dependent on any particular instance of a control and is always accessible even
if no control have been created yet.
The main property of the context is the Active property. It is false by
default. If it was set to true any KernelCAD controls will use the context to
during creation to determine the type of the control requisted 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 |
TransparBackgrEnabled |
Will be copied to
TransparBackgrEnabled |
Boolean |
False |
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 |
HandleComposited |
If true and the KernelCAD control is being created as child of a
window, which (or any of its ancestors) has WS_EX_COMPOSITED extended window
style on, the control will be created in Dual Mode.
In the case, if this property is false, the control might not work properly |
Boolean |
True |
Extended properties
There is a single ForceDual extended property. This property should
be used as the last resort for cases of complex and unusual views, hosting a
runtime created KernelCAD control, which do not provide full support for 3D
rendering. After this property was set to true (false is the default) any
controls will be created in Dual Mode regardless of
runtime properties of the container.
To access the property call
IControlInitialisationContext_KC.GetExtendedProperties() (See below) and use
IKCContext.SetBoolParam(0, value)
and
IKCContext.GetBoolParam(0)
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.
It is recommended to call IControlInitialisationContext_KC.Activate(false)
prior to that.
|