LabVIEW Idea Exchange

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

Provide a malleable "Traverse For G Objects" function

Status: New

We've all probably found ourselves writing various forms of this:

TurboPhil_0-1621002015826.png

It would be great if there was a malleable version of the "Traverse For G Objects" function that shipped with LabVIEW to save a few headaches. Rather than passing in a string for the class name, and then adding a downstream ToMoreSpecific operation, it could accept the refnum constant (in the above example, the "Control" class ref) and return an array already cast to that class.

 

4 Comments
crossrulz
Knight of NI

Could not give this a kudos fast enough!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
TurboPhil
Active Participant

I tried making a malleable of this myself, but ran into issues:

TurboPhil_0-1621007563991.png

 

It turns out, you can't get the ClassName from a refnum constant (the constant is not a *valid* reference). You *could* still require passing in the class name along with the class itself, but that feels lame.

wiebe@CARYA
Knight of NI

You can use Get Refnum Information.vi on the reference control.

 

Get Refnum Information.vi returns an "VI Server generic type" enum. There seems to be a 1-1 mapping between classname and the enum value.

 

One could probably script something to change a class constant to all possible classes, run Get Refnum Information.vi on each value, to get the enum value...

raphschru
Active Participant