Events from non-gui .NET component

Forums for specific tips, techniques and example code
Daniel
Posts: 8
Joined: Tue Sep 15, 2009 2:16 pm

Events from non-gui .NET component

Postby Daniel » Wed May 22, 2019 10:41 am

I have imported the .NET FileSystemWatcher class and are trying to get its event(s) passed to Jade.

For testing, I have a form with a reference to the imported class, and can create it and set it up okay.
I have tested the FileSystemWatcher.waitForChanged method which waits for a file change to occur and then continues executing the current method. This works fine. However I cannot work out how to correctly populate the params in Jades beginEventNotification(receiver: Object; ref: Feature) method (Jade adds it to the imported class), in order to get the events to be passed through to JADE for handling.

The documentation for the beginEventNotification method states: The receiver parameter is the object to which events are delivered. The ref parameter is a reference property on the receiver of the type that contains the events.

When I click on my forms reference to the FileSystemWatcher class, the event methods are there for use, but I believe I need the beginEventNotification method to be called to get jade to actually enable those event methods.

Any help would be much appreciated :)

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Events from non-gui .NET component

Postby ghosttie » Thu May 23, 2019 11:19 am

We have an ActiveX control to receive DDE messages imported into JADE, and as well as the component itself (FVDDEHlp2) JADE imported an interface (I__FVDDEHlp2) which inherits from IDispatch which has the events on it.

So to use it, as well as adding a FVDDEHlp2 property we had to add a I__FVDDEHlp2 property and connect them up in the Form::load with dde.beginNotifyAutomationEvent(self, MainForm::dde_events.name);
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

Daniel
Posts: 8
Joined: Tue Sep 15, 2009 2:16 pm

Re: Events from non-gui .NET component

Postby Daniel » Fri May 24, 2019 8:22 am

Thank you ghosttie,

The info you posted regarding the params you use for Activex was the key to getting it going. The syntax of the second param in particular was the crucial bit. (I had been so close, but no dice).

The .NET is a little different in the import, as it doesn't create a separate class for the events, rather they are in the actual class you're bringing in -which is nice.

Thanks once again :D

advaro
Posts: 19
Joined: Mon Oct 10, 2016 5:59 pm

Re: Events from non-gui .NET component

Postby advaro » Fri Aug 20, 2021 8:49 am

Hi - I'm just playing with a similar thing, a non-gui .Net library for SFTP, but I can't work out what these receiver and ref things are meant to be.

The SFTP has a number of events you can listen for, eg, connected, disconnected, errors etc...
They are all seperate classes that have been imported OK.

So what is the receiver? Do I create an instance of each of these classes that is an event and call beginEventNotification for each of them?
But none of them have any references, and certainly none that as per the docs "are shown grayed out (disabled) until you add code to that event. This is identical to defining an event on a control in a form by selecting the form, selecting the control, selecting a method (for example, the method) to implement, and then adding your event logic."

On what class am I meant to be seeing the greyed out events like you would on a form?

It's sounding like I need to make a GUI form and make that my receiver, but this SFTP is non-gui and will run on the server, I'm also assuming because receiver is an Object and not a Control or Form then we should be able to do it non-gui but I'm stuck..

Are you able to paste a bit of sample code Daniel how you got it working, or anyone else?

Thanks for the help
Stephen

gtcp
Posts: 6
Joined: Tue May 18, 2021 6:28 am

Re: Events from non-gui .NET component

Postby gtcp » Sun Aug 22, 2021 9:22 am

You see the events in the IDE when you select a property whose type is your non-gui .NET component, FileSystemWatcher. The property can be on any class. The receiver parameter for beginEventNotification needs to be an instance of that class. The feature parameter needs to be the property of that class.

This works for non-gui .NET components i.e. subclasses of JadeDotNetType. It doesn't work for gui .NET components i.e. subclasses of JadeDotNetVisualComponent. The events on them can be used if you add the component to a form in Painter. Perhaps you can use setEventMapping, but if so that'll only be to methods on the form. Either way that's not helpful for component-building.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: Bing [Bot] and 7 guests