LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does LabVIEW allow me to have 2 controls with same name

Back to the original Q!

"Why does LabVIEW allow me to have 2 controls with same name"

I can offer two guesses.

1) Imagine what a pain it would be to swap the labels on two controls if LV prevented them both being named the same.

2) LabVIEW simply does not care (bugs aside).

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 21 of 33
(1,808 Views)
The simplest solution would be to add an option like "Warn me if multiple controls have the same label." This wouldn't break any old code, it would just warn you if you name 2 controls the same or open a VI that contains multiple controls that have the same label. I would use it. I've never really had a problem with this, but I have noticed that it is allowed and I agree that it can get confusing.
Message 22 of 33
(1,799 Views)

5 stars for Marc A.  That is the best solution.  A warning that would help those with a problem without breaking legacy code.  Turning the warning on or off could be a configurable option.

 

Maybe I broke something.  I don't see the 5 stars that I gave Marc.



Message Edited by tbob on 12-20-2007 08:38 AM
- tbob

Inventor of the WORM Global
Message 23 of 33
(1,781 Views)

tbob wrote "Maybe I broke something.  I don't see the 5 stars that I gave Marc."

No you did not break anything (yet). The stars are on a time delay ever since the Forum got updated.

But after about 6 more postings, you will be "breaking" something.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 24 of 33
(1,769 Views)


Ben wrote:

tbob wrote "Maybe I broke something.  I don't see the 5 stars that I gave Marc."

No you did not break anything (yet). The stars are on a time delay ever since the Forum got updated.

But after about 6 more postings, you will be "breaking" something.

Ben




I didn't know about the time delay.  Haven't had too much time lately to spend on the forum, very busy at work right now and for the next several months (which is a good thing).
 
Yeah I should have broken the 2K barrier months ago...  now its 5 more postings.
- tbob

Inventor of the WORM Global
Message 25 of 33
(1,762 Views)
As long as you are aware that two controls / indicators can have the same name, you simply have to be careful when using that aspect of LV.  The "name" or Label is not the "real" name of the object.  It is something visual to simplify coding.  The actual names are some code that's hidden from us.  And each object, whether sharing a similar Label, most likely has a unique identifier (name), which is unknown to the typical LV programmer.  Now, if you do a bit of searching, you can probably find the actual name of a given control or indicator.. 😉
 
 
Message 26 of 33
(1,725 Views)
Like imtis said
the language doesn't use the names as a reference, but that is inconvenient when the name is the primary reference that the programmer has to keep track of

 
Marc A's solution seems to be the one that would keep everybody happy-- 
A VI Property similar to the following
If multiple controls have the same name
 o 1) ignore
 o 2) warn
 x 3) disallow
Option 3 could be the default for all future applications. 
S G
Certified LabVIEW Architect, Certified TestStand Architect, Certified Professional Instructor
Message 27 of 33
(1,718 Views)
VI Analyzer?

I don't have it hand at my current PC, so I can't check, but that would be an excellent case for it.

Darren?

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 28 of 33
(1,714 Views)
I happened to be installing a toolkit yesterday and added VI Analyzer to the list.  It does indeed catch the duplication.




Message Edited by Matthew Kelton on 12-20-2007 12:08 PM
Message 29 of 33
(1,711 Views)
Disallow?  I always dislike it when a computer thinks it knows what's best for me and won't let me do what I want to.  I think warnings are good enough.
Message 30 of 33
(1,476 Views)