LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI controls identification

Hi, i'm trying to save VI controls values to config file by using "Get VI Controls" method. All work good, but if i have number of controls with same name i have problem, because i don't know what control have this value.
There is some property of control that identificate it?
0 Kudos
Message 1 of 12
(3,436 Views)
Hi

Use the controls caption for identification on the frontpanel. Use the label on the block-diagram and there set unique names.

Hope this helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 12
(3,433 Views)
The problem that controls can have same caption. And i can't set unique names because my application get as input different VIs in run time so you don't know what VI you will get and i must save all controls values in run time.
0 Kudos
Message 3 of 12
(3,430 Views)
How do you store the data? Could you maybe post some code?
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 12
(3,428 Views)
Hi, i attached llb with 2 vis (save and restore)
LV 6.0.2 Win2000
0 Kudos
Message 5 of 12
(3,426 Views)
Attached is a solution I once used.

I read the label (which should be unique e.g. strReadSettingsVal) and wrote the value and the label to a key-value file (as you do).
In the label I used type-identifiers to be able to cast the values back (e.g. str for string, i32...).

The caption (as mentioned earlier) is not used during the process of saving data and for that reason it needn't be unique.

Maybe this helps.

Thomas

Message Edited by becktho on 04-13-2005 01:50 PM

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 6 of 12
(3,421 Views)
Thomas,

i haven't posibility to set unique labels for controls because i get any VI (from internet for example) in run time and i must save controls without to change it
0 Kudos
Message 7 of 12
(3,415 Views)
Is it possible to concatenate the name of the vi with the name of the control? It sounds like you would be getting controls with identical names from different vi's. If this isn't the problem them I guess I would need a little more clarification.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 8 of 12
(3,412 Views)
The problem that i can get any VI that have 2 or more controls with same label and caption. Now if i use method "Get all VI controls" i get 2 controls with same name and i don't know how to recognize for which control i have value.
0 Kudos
Message 9 of 12
(3,406 Views)
Ouch, that's simply bad programming from whoever programmed the VIs you're getting the values from. There's no great way to seperate them unless you simply watch which position in the array from "Get control values" the value is in. This way you can index each name.

If you have a value for a control "X", and you need to write the value to a control, and the target VI has two or more "X" controls, you'll need to do some workarounds, but it won't be pretty.

In your case, are the controls with the same name also of the same datatype? Maybe you can differentiate them using the type descriptor which is returned from the "Get all control values" function (LV 6.1)?

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 10 of 12
(3,399 Views)