07-09-2010 04:26 AM
How LabView resolves name conflict when two indicators or controls are with same labels .In C declaring different variables is impossible,
as this will throw the compiler error?
07-09-2010 05:12 AM - edited 07-09-2010 05:13 AM
I think how LabVIEW resolves the conflict is not important if you stop thinking of controls & indicators as variables. Use the wire as the variable and there's no confusion. I believe, however, that how LabVIEW resolves the conflict is indeterminate.
You shouldn't use the duplicate labels, anyway, use the object's caption instead.
07-09-2010 08:19 AM
@JeyZ wrote:
How LabView resolves name conflict when two indicators or controls are with same labels .In C declaring different variables is impossible,
as this will throw the compiler error?
With the exception of the Invoke Node Set control value method, LV does not depend on the controls name. It makes it hard for the developer when they have the same name but LV really does not care.
BTW: The previous post about not thinking about controls and indicators as variables is important when trying to understand how LV works.
"The wires are the variables."
If you still are using ideas from C that depend on you having names for each variable, then drop a free lable on thediagram near the wire to help you out. Eventually (if you are like me) you'll not need teh lables anymore.
Ben
07-09-2010 09:57 AM
Whatever you call a variable, be it the wire or the control, LabVIEW should not allow duplicate labels. When you copy a control and paste a duplicate, it adds a 2 after the label. So even Labview won't duplicate the label. Why would it allow a user to do so. I know that Labview doesn't care, but lets make this a bit more user friendly shall we. Users use labels and refer to labels (or captions) to identify variables. Its a throwback to text based programming, but the notion will not ever go away. I've been using LV for over 10 years and I sitll rely on labels and captions to identify variables. A wire is variable, a control is variable, an indicator is variable. They all can have their values changed. Therefore they are all variables by definition.
07-09-2010 10:12 AM
@tbob wrote:
Whatever you call a variable, be it the wire or the control, LabVIEW should not allow duplicate labels. When you copy a control and paste a duplicate, it adds a 2 after the label. So even Labview won't duplicate the label. Why would it allow a user to do so. I know that Labview doesn't care, but lets make this a bit more user friendly shall we. Users use labels and refer to labels (or captions) to identify variables. Its a throwback to text based programming, but the notion will not ever go away. I've been using LV for over 10 years and I sitll rely on labels and captions to identify variables. A wire is variable, a control is variable, an indicator is variable. They all can have their values changed. Therefore they are all variables by definition.
Why?
Not being in the design meeting we can only specualte but I would think "Why not?" It does not hurt anything, besides, it is a bit of an eye-opener for text coders to get them thinking that there is something differnet about LV.
Done speculating.
Ben
PS: I avoid duplicate names.
07-09-2010 10:50 AM
@Ben wrote:
Why?
To help the user avoid making a blunder.
@Ben wrote:
"Why not?"
To help the user avoid making a blunder.
I need all the help I can get.
PS: I don't use duplicate names either, but I have inherited some code where a duplicate name was used. Very confusing. There was a property node. Which control did it belong to? "Numeric" or "Numeric"? Of course it was easy to find by right clicking and selecting Find Control. But this should not be allowed.I don't want to have to think more than I already have to. I'm lazy.
07-09-2010 10:58 AM
@JeyZ wrote:
How LabView resolves name conflict when two indicators or controls are with same labels .In C declaring different variables is impossible,
Each object has its own reference. Whether it is a wire or a control.
So if two objects have the same name (ie two controls called Numeric), they have their own unique reference designator. That is how LabVIEW keeps track of each object.