LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Polymorphic XControl

Does anyone know if we can create polymorphic XControls in LabVIEW?

 

I have a need to make an XControl accept one of two distinct datatype. For a subvi I'd simply create a polymorphic vi which would automatically select the correct vi based on the datatype.

But for XControls? Is this possible? And if not, does anyone have any suggestions about how one could create a 'seemingly' polymorphic XControl that adapts to the datatype wired to it - such as an XControl that automatically replaces itself with an appropriate sister XControl that's compatible with the new datatype? Is that scriptable?

 

Yours hopefully,

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 1 of 7
(4,214 Views)

I think that would require an XNode which is code that runs on the BD at edit time rather the FP like a normal XControl. There was info on LAVA when Scripting first came to light about XNodes. THe OLD LV State Diagram was an example of an XNode. It was able to redefine the state transitions (via an enum) at edit time.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 7
(4,204 Views)

Thanks Ben.

Yes, I have heard of the secret power of XNodes and have always wondered about developing something that uses one.

Due to NI's denial of their existence they're undocumented/unsupported and presumably therefore difficult to implement? Still worth a look though. Thanks for the tip! Smiley Happy

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 7
(4,198 Views)

@Thoric wrote:

Thanks Ben.

Yes, I have heard of the secret power of XNodes and have always wondered about developing something that uses one.

Due to NI's denial of their existence they're undocumented/unsupported and presumably therefore difficult to implement? Still worth a look though. Thanks for the tip! Smiley Happy


Your signature says you are using LV 7.0 .

 

The version of the SDE released with that version shipped without a password. Smiley Surprised

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 7
(4,196 Views)

 


The version of the SDE released with that version shipped without a password. Smiley Surprised

Smiley Wink

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 7
(4,189 Views)

 


@Ben wrote:

 

The version of the SDE released with that version shipped without a password. Smiley Surprised


It also used External nodes, not Xnodes. Those are 8.x only.

 

 

Here's one suggestion, although my experience with XControls is limited, so I don't know if this will help or what kinds of issues you'll run into.

 

Make the data type of the XControl a variant. Then, use the VIs in <vi.lib>\Utility\VariantDataType to find the exact data type of the data wired into the control and use that to change the appearance of the facade VI.

 

The main disadvantage of this is that you have to have all the code in a single facade VI and that the terminal of the XControl will have a variant data type.

 


___________________
Try to take over the world!
Message 6 of 7
(4,179 Views)

I've just added Polymorphic XControl as an idea in LabVIEW Ideas Exchange board.


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn

Stop writing your LabVIEW code documentation, use Antidoc!
0 Kudos
Message 7 of 7
(3,979 Views)