From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic events not passing data properly when using class private data

Solved!
Go to solution

I thought I understood dynamic event triggering, but clearly I am missing something.  I am working on a application that involves software triggering.  Basically, I want to use a front panel Boolean control to initiate a dynamic event (rather than a static event).  This is actually quite simple to do: create event with a label and data type, register event, add event case for your front panel control, and then generate the event when that control is activated.  This passes the data to the dynamic event.  However, if you put the event in the class private data of a particular class (e.g. in the Actor Framework), this no longer works.  It does not pass the data. Instead of passing 'trig' (the label of the event), it passes 'stop', which is the label of another event (the CPD has two events, stop and trig, each Boolean).  The two events are created in pre-launch init.  I've also attached a vi that works perfectly but doesn't CPD (or AF).  What is the difference between the two approaches?

 

 

 

 

 
0 Kudos
Message 1 of 10
(2,673 Views)

Not clear for me what are you trying to achieve but can you save the VIs in an older LabVIEW version? I don't have LV19 yet.

Lucian
CLA
0 Kudos
Message 2 of 10
(2,634 Views)

Hi,

 

I want to do the following simple task: I want to use a front panel control to pass data to a dynamic event, 'Trig', which, for the purposes of this example, just turns on an indicator light.  The straightforward way to do this is shown in Dynm events working.vi.  I created a user event called 'Trig', registered it, and then whenever someone clicks on the Trigger front panel control, it generates this event.  The data is then passed to the dynamic event and turns on the indicator.  So the Trigger control is controlling the indicator light but it does so through this combination of a static and dynamic event.  This works just fine.  However, if I have the event stored in the class private data of a class, e.g. as shown in the Actor Core.vi, this no longer works.  Everything here is the same except that I created the user event in prelaunch init.vi, and then I unbundled it in the actor core.vi.  However, instead of passing the data to the dynamic event 'Trig', it is passing data from a different event 'Stop'.  There are two events defined in the class private data of Actor One.lvclass (Stop and Trig).  My question is why doesn't the 'Trig' data get passed just like in the Dynm working.vi case?  It's the exact same thing, isn't it?  The reason I want to do it using the class private data is so that I can generate events during messaging in the Actor Framework.  I saved it in an older labview version (v16)

0 Kudos
Message 3 of 10
(2,631 Views)

You forgot to upload Actor One.lvclass so everything is broken and I cannot debug. I'll try to build my own example in the meantime.

Lucian
CLA
0 Kudos
Message 4 of 10
(2,626 Views)

The forum doesn't allow me to load .lvclass (filetype not supported).  

0 Kudos
Message 5 of 10
(2,624 Views)

Here is my working example with LV18 (zip file attached).

I noticed that in your <Trig>:User Event, the indicator is not wired:

Indicator not wired.png

Lucian
CLA
0 Kudos
Message 6 of 10
(2,617 Views)

@speclabAI wrote:

The forum doesn't allow me to load .lvclass (filetype not supported).  


Put everything into a zip file and post that.  It makes life easier on everybody.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(2,611 Views)

Hi,

 

Yes, I got the same result.  My question is why the data is labelled as 'Stop' and not 'Trig' in the bottom left hand corner of the UI Events.  In the traditional way of doing it (without bundling into the CPD), the data for the trig event is labelled as it was when the event was created.  

0 Kudos
Message 8 of 10
(2,587 Views)
Solution
Accepted by topic author speclabAI

This is because when I created the controls to be added in the actor private data, I created the refnum from Create User Event function of the "Stop" event (right click on "user event out" -> Create -> Control) and then I copied the resulted refnum control and labeled it "Trig Ev". If instead of that, you create the second refnum from the Create User Event of the "Trig" event, the data of the event in the Event Structure will be labeled correctly "Trig".

Lucian
CLA
0 Kudos
Message 9 of 10
(2,562 Views)

Thank you. I think that cleared it up for me.  I just couldn't understand how the two were different.  Much appreciated!

0 Kudos
Message 10 of 10
(2,534 Views)