LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Event

The Help surrounding User Event seems circuitous to me.  I can find out how to name an event, register an event, send a event, and act when an event occurs.  What I can't figure out is: what is the actual event in the examples shown? In the Programmatically Fire Events.vi example, I see a cluster of two integers attached to the Create User Event.  What "event" is represented by this?  A change in one integer, both?  How is this a "User" event?  What I need is a simple TEXT explanation that builds up a User Event step by step with numbered steps, starting with an explanation of what kinds of events can be used as User Events and building from there through the creation and registration of events to their actual use.  This is a fundamental tool for modern instrumentation programming and I don't feel I'm getting the help I need.

0 Kudos
Message 1 of 23
(8,036 Views)

The Create User Event outputs an event refnum. That refnum is then passed to a Generate User Event. That *is* the event. To put it another way, the event that you are watching for is "someone called Generate User Event with this refnum." The value of the event is whatever data you put into the Generate node.

 

From your description, it is unclear what sort of help change you'd like to see. I'm going to highlight a section of the existing help that I believe answers one of the questions that you had. Please review it and then explain what change would help clarify. With a more concrete explanation of what's missing, we may be able to better describe the situation in our help. The following section comes from the help for the Create User Event function. This part describes where the name comes from. The underlining in the following was added by me.

 

Quoting from the LV help for the Create User Event function:

The user event data type is a cluster of elements or an individual element. If you wire a cluster to the user event data type input, LabVIEW uses the type name of the cluster as the name of the user event. The names and data types of the cluster elements define the event data the user event carries. If you wire an individual data element to the user event data type input, LabVIEW uses the type name of the element as the name of the user event and as the name of the single data item it carries, which is the same data type as the element. The actual value you wire to the function is not important because LabVIEW uses only the name and data type to define the user event. The user event out output is a strictly typed refnum that includes the user event name and event data type.

What would you add or rephrase in this?

Message 2 of 23
(8,010 Views)

Did this information help? Is there something specific we could change to the LabVIEW Help file to help with user generated events?

0 Kudos
Message 3 of 23
(7,991 Views)

If there isn't anything specific that we could add to the LabVIEW Help file on user generated events then I will Decline this idea as just a support question. Please let us know if we could do something specifically to make this better. Thanks!

0 Kudos
Message 4 of 23
(7,974 Views)

I'm looking at Programmatically Fire Events.vi

 

I see that the Create User Event has some constants attached which apparently "type" the event.

I see the Register User Event  which I suppose adds to a database of accessible events.

Inside an event called "Slider", I see a Generate User Event.

 

I am confused because the Event used in the Event Structure Case 0 is "Slider" Value Change.  I can understand an event in that context:  the slider moves, values change.

But then inside that event, a refnum connects to the Generate User Event this serves as a "name" but it is only code-readable so at this point, I have no idea what the name of the event within the event is.  

 

Connected to Generate User Event is a bundle of "something" called NewVal and a 0.  I suspect this means the User Event is "generated" when position has a new value (presumably the value resulting from the slider value change) and delay is 0.

The event is "generated" but I STILL don't know what that means.

 

In Event Structure Case 1, triggered by event Repeat switch Value change, a Generate Event with the same refnum "name" as before occurs when some calculated values are reached.

After the loop finishes, the refnum goes out and generates a new User Event with the same "name"

when position is -1 and delay is 0.  

 

I am primarily interested in events as triggers for Cases in Event Structures.  I thought User Event meant some kind of user-defined event that I could use for such a trigger.  Instead, I see in this example that some other event triggers the Event Structure Case in which the User Event is "generated" and I have NO idea what happens that "event".

 

So, either the term "event" is used in some wildly differently context or I need more help.  I have now seen the same refnum generate an "event" based on three different inputs.  How is that not too confusing for a Help example?

 

How can I tell what help I need?  This is the most confusing example I have encountered in my long history as an engineer.

 

Where does the generated event go?  How do I use THAT event?

 

I just can't tell from what is provided and I can't find a tutorial or a book that describes it.

0 Kudos
Message 5 of 23
(7,965 Views)

I agree that the example is confusing, but we should probably move this discussion to the regular forums, since it's a support question and not a feature request.

 

That said, I'm going to try a brief explanation to see if I can clarify things for you.

 

Register User Event - think of this as creating an event queue.

 

Generate User Event - executing this function fires the event. Think of it as putting the event on the queue. You can pass data to the event structure frame that will handle the event. The data type is defined when you Create User Event.

 

It sounds to me like User Events do exactly what you're looking for, but this example is giving you an erroneous impression of how they work. If we move this discussion to the forums, we can talk more about what your specific need is so that we can provide a more applicable example.


Christina Rogers
Principal Product Owner, LabVIEW R&D
0 Kudos
Message 6 of 23
(7,954 Views)

I was beginning to suspect that User Event isn't an event at all but a package of queued data.  I am reluctant to have to post this on an open forum between the me-toos, the you're-so-dumbs and the isn't-this-in-the-manuals, it is a very trying experience for me.  Is there REALLY no reference to a book or real tutorial about User Events to which you could direct me.?

0 Kudos
Message 7 of 23
(7,948 Views)

>  Is there REALLY no reference to a book or real tutorial about User Events to which you could direct me.?

 

The help that ships with LabVIEW for the User Event functions plus the shipping examples are what we thought was sufficient help for this API. The problem with writing documentation is that it is easy to misjudge what kind of documentation is actually needed for a feature. Apparently, we've made that misjudgement in this case.

0 Kudos
Message 8 of 23
(7,945 Views)

So, that's a no?  Not even a third-party reference?

0 Kudos
Message 9 of 23
(7,942 Views)

Does this help?  I drew it up and annotated it a bit.

 [EDIT] Added the unregister and destroy nodes.

Events2.png

Message 10 of 23
(7,941 Views)