03-08-2016 02:56 PM
I am a little confused by the examples. I have an SMO where I send commands as a string, but I want this SMO to "publish" certain events, and I need that to be a separate data type. How do I add additional events with differing data types that can be registered by other VI event structures?
03-09-2016 12:41 PM
Hi Jed, thanks for the question.
I assume you started with one of the templates that has an event example. If you want to publish events of different types, you need to add all your events to the PublicEvents.ctl
After that, any event structures that want to register for them need to call the GetPublicEvents.vi method from your SMO.
I hope this helps you. Let me know if you have any further question.
03-09-2016 02:21 PM
Apparently I also have to overload/create a parallel version of Set Data?
The problem I am having is that the use of the word "data" is very general. I cannot tell which methods I would need to create/overload/modify and which will take care of themselves due to class relationships.
I duplicated your modification to the Control with a DBL. It seems that I have to create a parallel function to setData to update the DBL. Is that the case?
03-09-2016 03:03 PM
Hi Jed,
If this is a Public Event (event for which other event structures will register), you need to "generate" that user event from within your SMO. You are correct that a way to do it would be to use a similar method to SetData, which in its simplest form would look like this (assuming you have a Public Event called "New DBL"):
This is a method that DOES NOT override any other method from the parent class.
I just posted a link to a new version of the SMO Editor, which creates these Events for you.
03-10-2016 11:18 AM
I just posted a link to a new version of the SMO Editor, which creates these Events for you.
Haha! I just checked it out. Nice work! Thank you!
03-10-2016 02:49 PM
Thank you, I just tried it out, and it works well. A bug you might want to address though, is that I dropped a TypeDef cluster into the create event utility, and this wreaked havoc.
03-10-2016 02:52 PM
Thanks Jed,
I will test this and make sure it gets fixed. Your usecase was: "you have a typedef that needs to be part of your event, along with other control types", is this correct?
03-10-2016 03:37 PM
It was a typedef cluster with 4 DBLs in it. That caused problems. I reverted the code and then placed the 4 DBLs separately on the editor and it worked. I can't tell you if the problem was the cluster or the TypeDef.
Note: I did notice that the first thing it did was to add a cluster around the TypeDef cluster.
03-11-2016 02:07 PM
OK, here's another question...
What's the best way to make a data request from an SMO? I need a public function that will return data currently being processed by the SMO.
-The simplest way seems to be to maintain that data in the SMO Class defintion. This way public member functions can access it for non-member code. However, this would require modifying the class private data definition, and I am not sure if this would break your code (or the tools used to add events).
-The other method seems to be much too convoluted... create one event INTO the SMO to trigger an event OUT of the SMO. Of course, the problem here is that all subscribers would be updated, which isn't necessarily what we want.
03-14-2016 12:37 PM
Hi Jed:
Modifying the private data will not break the editor, so this is a valid option as long as the ByVal vs ByRef differences are understood.
I personally like the following way, with a private reply event, but we don't have the scripting working for this yet.
(This is the public method that waits for a reply)