LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine if a control reference is a strict type definition

If a VI is passed a control reference it can determine the VI Server Class using the ClassName property but how can it determine if the control reference is from a control which is based on a strict type definition?
0 Kudos
Message 1 of 6
(2,666 Views)

I never tried that before but I suggest you start with the "to more specific" node and after attempting to cast is as the stict type, check the error cluster to see if it worked.

Just my first thought, so forgive me if that does not work!

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(2,659 Views)

Hi,

Did this work out for you?

Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments
Message 3 of 6
(2,615 Views)

I think the original question has to do with figuring out whether or not a given control is a typedef or not.  I don't think Ben's approach would work in this case.  To figure out whether or not a control is a type definition, I recommend using vi.lib\Utility\VariantDataType\GetTypeInfo.vi on the value of the control.  If a control is a type def or a strict type def, that fact is reflected in the actual data type of the control.  So you can analyze the control's data type to determine whether or not this is the case.  Try writing a VI like this:

The GetTypeInfo.vi is available in at least LabVIEW 8.2, maybe earlier.

Let me know if you have any further questions,
-D



Message Edited by Darren on 02-06-2008 11:16 PM
Message 4 of 6
(2,604 Views)
Thanks for the info. I stumbled across the variant directory yesterday and found your solution to be the best to date.
0 Kudos
Message 5 of 6
(2,584 Views)

That a pretty neat little VI you've found, Darren. Kudos!

The solution that Darren presents, however, will not tell the difference between a typedef and a strict typedef (unless I'm missing something). If you have VI Scripting enabled (see attachment for where to enable this in the Options menu), you can expose the Is Typedef? property. 

 Untitled.png

This returns an enum with the following values (as pictured)

  • not a typedef
  • typedef
  • strict typedef
  • class private data

Although this property is not settable in a VI at run-time, it should be readable.

 

Below is a picture of the Options menu where you can enable VI scripting

VIScripting.PNG

Mitch
0 Kudos
Message 6 of 6
(1,829 Views)