05-30-2014 08:40 AM
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.
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:
Thanks in advance for any help...
05-30-2014 08:51 AM
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.
05-30-2014 08:55 AM
The subVI isn't run until after the until after the control value is set...here's the full view:
05-30-2014 09:25 AM
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.
05-30-2014 09:46 AM
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...
05-30-2014 10:54 AM
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?