06-28-2010 06:56 AM
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,
06-28-2010 07:44 AM
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
06-28-2010 08:01 AM
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!
06-28-2010 08:08 AM - edited 06-28-2010 08:08 AM
@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!
Your signature says you are using LV 7.0 .
The version of the SDE released with that version shipped without a password.
Ben
06-28-2010 08:11 AM
06-28-2010 10:22 AM
@Ben wrote:
The version of the SDE released with that version shipped without a password.
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.
02-18-2011 07:12 AM - edited 02-18-2011 07:12 AM
I've just added Polymorphic XControl as an idea in LabVIEW Ideas Exchange board.