Non-GUI .NET Components

The classes created under the JadeDotNetType class are proxy classes for their corresponding .NET classes. By using the proxy object, you gain access to the .NET object. Therefore, to access the actual .NET object you must first create an instance of the Jade class. This Jade instance can then be used to create the .NET object, by using the createDotNetObject method, which in turn causes the .NET run time to create the instance of the corresponding .NET object. Generated methods on the Jade proxy class can then be used to access corresponding members on the actual .NET object.

Before creating the .NET object, the usePresentationClient property can be set to specify where the component should be run. (By default, all components run on the presentation client.)

The following method shows how the generated classes and methods are used.

vars
    b, b2 : Basic;                            // Subclass of JadeDotNetType
begin
    // Create a Jade instance of the class representing the .NET object
    create b transient;
    // Optionally, specify where the actual .NET object is created
    b.usePresentationClient := false;
    // Request the creation of the corresponding .NET object
    b.createDotNetObject;
    // Use methods and properties on the Jade instance
    // to access members of the .NET object
    write b.integer;
    b2 := b.anotherOne;
epilog
    delete b;
    delete b2;
end;

Event handling on components is a little more complex. By default, component events are not passed onto Jade. To start receiving such events, a call is made to the beginEventNotification method if the JadeDotNetType class, which takes the following parameters.

Events are implemented in the Class Browser, by clicking on the reference property in the receiver class, which displays all of the events available in the method pane. These events are shown grayed out until you add code to that event. This is identical to how you code an event on a control in a form; that is, with the form selected, click the control reference, select the methods to implement (paint or click), and then add your event logic.