05-21-2019 03:54 PM
I often need to enable or disable controls conditionally so I created a VI to do just that. My problem is that the type of the control refnum is lost this way. Is there some way to preserve the type?
Solved! Go to Solution.
05-21-2019 04:41 PM
Make a polymorphic VI (or whatever the 2018 equivalent is called) for all of the different types of control references.
05-21-2019 04:44 PM
I realized moments after posting that I should have said, ". . . that doesn't require making a polymorphic VI for every type of control refnum".
So, is there any other way?
05-21-2019 05:01 PM
I don't think so. How else can you change the output terminal to be a different reference type?
Malleable VI's may not work in this case. I've never used them so I can't say for sure.
Do you really need the reference as an output? Could you not branch the wire before the subVI?
05-21-2019 05:46 PM
You can do it by making two subVIs, a VIM and a normal subVI. For the VIM you need to set the VI properties correctly, like so
Make sure you save the extension as VIM.
Set up you VIM like so,
The subVI in the case structure is just what you had before,
You have to do it this way because the property node cannot be inlined.
mcduff
05-28-2019 11:41 AM
I was just able to test and this works.
However, I'm going to go back to just branching before sinking the ref in the VI because I can't put the VIM in my UI utilities packed library.
It bothers me that the refnum type isn't preserved like a class type with a dynamic terminal, but I imagine changing that would not be worth the massive effort.
05-28-2019 12:09 PM
Are VIMs not compatible with packed libraries? Sorry, I had no idea.
Below is the basically the same VIM except the wire is not branched, it goes through the subVI, you just need to add one more step.
mcduff