LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get specific data type of numeric control by reference

Solved!
Go to solution

Is there a property to figure out if a numeric controls data type is e.g U32 or I64? I hand the control to a SubVI by reference.

 

0 Kudos
Message 1 of 11
(1,383 Views)
Solution
Accepted by topic author Quiztus2

There is a property called "Representation" when you enable scripting.

 

Data Type.png

0 Kudos
Message 2 of 11
(1,377 Views)

Thanks for suggesting Representation. I can't find this on my properties. 

Is there no way without Scripting?

 

edit: I enabled scripting and now Representation shows up. Thx

0 Kudos
Message 3 of 11
(1,332 Views)

Beware that scripting properties are not available in executables.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 11
(1,311 Views)

I have a .ctl containing different Rings and Numerics. I hand this .ctl via it's reference to my SubVI, because the Rings StringsAndValues[] are edited.

If I pass the .ctl via Value those StringsAndValues[] are lost. That is the reason I have to pass by Ref.

So can I cast my reference to my specific control then? If yes, how do I generate a class from my specific .ctl ?

0 Kudos
Message 5 of 11
(1,309 Views)

You can pass your reference as generic Control (as you probably are already doing), use "To More Specific Class" and check whether an error is thrown. But you must try with all possible types.

Edit: if the subvi expects only one type, you must pass a typed reference. To change the reference type, drag a control of desired type into the reference terminal control of the subvi.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 11
(1,300 Views)

As simpler way is to use the Get Type Information.vi.

Type test.png

Control reference is a generic Control GObject. Make this into a subVI and wire your control reference to it. You'll get a coercion dot, since it converts to the generic GObject class. However, you'll still get the correct data type.

Type Test Result.pngBasjong53_1-1666777312244.png

 

0 Kudos
Message 7 of 11
(1,258 Views)

@pincpanter wrote:

Beware that scripting properties are not available in executables.


I believe this one is available in the runtime engine.

0 Kudos
Message 8 of 11
(1,239 Views)

@Gregory  ha scritto:

@pincpanter wrote:

Beware that scripting properties are not available in executables.


I believe this one is available in the runtime engine.


You are right. Thanks, I learned something new.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 11
(1,208 Views)

If I understand correctly, not all festures of scripting are available in builds. How does one know? What about real time targets?

0 Kudos
Message 10 of 11
(1,138 Views)