LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble with user event

Hello,

In my application, I have a main VI that loads a separate VI into a subpanel based on some selections by the user.  As the user changes the value of controls within this subpanel, I need to process the event in my main VI.  It it working for some of my subpanels, but not others, which is confusing me because they're all basically the same.  That aside, the error I keep getting is an Error 1 in my Generate User Event function.

 

This is the screenshot of the relevant section of my main VI....on the left you see I create a user event and dynamically register it, and on the right you can see that same event (entering vertically from the bottom right) is assigned as the Value property of the subVI control called TelnetWriteEvent...not shown here is right after assigning that control value, I insert the VI into the subpanel.

ue.png

 

 

Here's the relevant portion of the subVI.  Here, I have registered various controls for value change or mouse events, and you can see in the lower left of the event structure I have a control TelnetWriteEvent on which I want to generate a User Event when any of those registered events occur:

ue2.png

 

 

Thanks in advance for any help...

0 Kudos
Message 1 of 6
(3,039 Views)

When is the VI ran?  This looks like it could be a simple race condition where the terminal is read in the subVI before you set it.


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 2 of 6
(3,031 Views)

The subVI isn't run until after the until after the control value is set...here's the full view:

 

ue3.png

0 Kudos
Message 3 of 6
(3,024 Views)

Does anybody close that user event?

 

The error code 1 tells me that your reference is invalid for one reason or another.  Things that would make it go invalid would be somebody closing the reference or the reference not being passed correctly.


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 4 of 6
(3,008 Views)

I had a suspicion along the same lines but couldn't articulate it...for what it's worth, I set a data probe on the user event wire that goes to the 'Value' property of the TelnetWriteEvent Ctrl Val.Set method in my screenshot.  When I run the VI and the default tab is loaded, it takes on a numeric value.  When I switch tabs, it retains the exact same numeric value.  I know I'm not closing the event on purpose, and if the wire retains the same value then it seems to indicate to me that nothing else is either...but I agree with your analysis that something is invalidating this reference...

0 Kudos
Message 5 of 6
(3,002 Views)

I figured it out!

 

A couple weeks ago, I wanted to test out passing a string down from the top level to display it in the tab in my sub VI.  To that end, I created a string indicator inside a sub VI called Top_labview.vi.  Top_labview.vi was the default tab that loaded into the subpanel, so it consistently worked.  However, I forgot to create that same indicator in my other sub VIs that could also be in the subpanel, so the field didn't exist.

 

In other words, where I have the Ctrl Val.Set method that assigns a value to the field called TabName, I forgot to create that field in all but 1 of my Sub VIs.

 

So apparently the way this error manifests itself is that if you don't have that field, it won't properly execute the SubVI.  It loads it into the panel and things look as normal, but I got the error on the generate user event.

 

I'm sure if I had error catching code at each step of the way, I would have seen this much sooner.

 

Can I give kudos to myself?

0 Kudos
Message 6 of 6
(2,986 Views)