LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

refnum of control by its name

Hello all.

I want to get refnum to control by its name.
Any suggestions?
0 Kudos
Message 1 of 8
(4,135 Views)
I've done this by getting the array of control refnums from the FP and passing them into a loop that compares the value of the label.text property of the refnums to name you want to find. This seems to work fairly well, although I imagine that you may run into some performance issues if you have a lot of controls to search through.

See the attached file for quick example of what I mean.
Hope this helps!

Brian
Message 2 of 8
(4,137 Views)

Hi Brian (or any other who helps me),

your example works fine in this case (and helped me very much). But I have some controls on a tab control, so I have no access to this controls by refnums (I only have access to the tab control). If, in the example above, you place a tab control on the front panel and move any Numeric on it, you don´t get the refnum of the moved control (only the last one in the array).

When I link a property node of any control on the control tab, at first I have to chose tab control, then the name of the control (in the next layer). I think this is the problem and I hope there is a solution.

Is there any possibility to get access to controls on a tab control by their refnum? It would give me great pleasure if you (or any other) attach a modified and working example.

Thanks for helping me,

Christian

--------------------------------------
I'm using LabVIEW 7.1
0 Kudos
Message 3 of 8
(3,982 Views)

Christian,

You can do this by using the tab control reference to get a reference to all of the controls on a given page.  I've attached a simple example that does this.  Just input the path of a VI that you want to find controls on and then run the VI.  It will display the names (and references) for every control in that VI (even ones in tab controls).  The only case where my example does not work is if you had a tab control inside another tab control.  Even for this case you could modify my VI pretty easily to work for this.

I hope this helps,
Justin D.
Applications Engineer
National Instruments

0 Kudos
Message 4 of 8
(3,951 Views)

Hello Justin,

can you save the file in LabVIEW 7.0 or 7.1 and attach it, please?

Thanks

 

PS: Is there the possibility to send personal messages in this forum?

--------------------------------------
I'm using LabVIEW 7.1
0 Kudos
Message 5 of 8
(3,913 Views)
Christian,

Please find Justin's example saved in LabVIEW 7.1 format attached (he's out of the office this week).

This forum does not have a personal message feature as often we have other users following a discussion and any relevant information could also help them out.

Regards,

Simon H
Applications Engineer
National Instruments
0 Kudos
Message 6 of 8
(3,872 Views)
Thanks for helping me to solve this problem.
 
Now I have the LabVIEW version I'm using in my signature. In some fora it is possible to show some text in the left box beside the message (where my username and the picture are) ; this text must be inserted in the profile. To prevent compatibility problems everybody could write the used version/program there.
--------------------------------------
I'm using LabVIEW 7.1
0 Kudos
Message 7 of 8
(3,828 Views)

Hello CWEISS,

Unfortunately, I do not know of a way to display which version of LabVIEW you are using on the left side of the forum.  I contacted our Web Support and Operations team to let them know of your suggestion.

Regards,

Janell Rodriguez | Applications Engineer | National Instruments

0 Kudos
Message 8 of 8
(3,800 Views)