LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Preserving Refnum Type

Solved!
Go to solution

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?

Enable or Disable Control.png

0 Kudos
Message 1 of 7
(232 Views)

Make a polymorphic VI (or whatever the 2018 equivalent is called) for all of the different types of control references. 

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 2 of 7
(209 Views)

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?

0 Kudos
Message 3 of 7
(206 Views)

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?

 

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 4 of 7
(199 Views)
Highlighted
Solution
Accepted by topic author auspex
05-28-2019 09:41 AM

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

Snap3.png

Make sure you save the extension as VIM.

 

Set up you VIM like so,

Snap4.png

The subVI in the case structure is just what you had before,

Snap5.png

You have to do it this way because the property node cannot be inlined.

 

mcduff

Message 5 of 7
(185 Views)

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.

0 Kudos
Message 6 of 7
(76 Views)

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

 

Snap1.png

0 Kudos
Message 7 of 7
(69 Views)