|
DigiPara Liftdesigner LDX API
|
Most objects in LDX support many interfaces. Ordinarily in COM, you use QueryInterface to cast between them; that is, unfortunately, not the way LDX is set up. Instead, for every logical X inherits Y relation, there is a property X.Y that allows you to cast up from X to Y.
As an illustration, here are the ways to cast up from ILDXCarFrame5 to its base classes ILDXMoveFrame5, ILDXComp5 and ILDXObject5:
classDiagram
class ILDXObject5
class ILDXCarFrame5
class ILDXMoveFrame5
class ILDXComp5
%% ILDXObject5 ..> ILDXComp5 : .Comp?
ILDXComp5 ..> ILDXObject5 : .Object
ILDXCarFrame5 ..> ILDXObject5 : .Object
ILDXMoveFrame5 ..> ILDXObject5 : .Object
ILDXCarFrame5 ..> ILDXMoveFrame5 : .MoveFrame
ILDXMoveFrame5 ..> ILDXComp5 : .Comp
ILDXCarFrame5 ..> ILDXComp5 : .Comp
These relations are listed in the See also section of the interface documentation.
Downcasting is always done from ILDXObject5.
If the object also implements ILDXComp5, that can be accessed with .Comp. If the interface is not implemented, that property is simply null.
To get to more specialized interfaces, we have two methods:
Both methods give you just an IDispatch. You should cast it to the desired LDX interface using as in C# and DirectCast in VB.NET. Check Retrieve specific interfaces for details.
Not recommended, as it is prone to surprising runtime errors: You can also just use the raw IDispatch with late binding. In C#, use the dynamic type. In VB.NET, use Object.