LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

getting label.value from ring control

Solved!
Go to solution

Hi,

 

I want to read the the text of the selected index in the ring control. Assume i have 5 different values(ONE,TWO,THREE,FOUR,FIVE) in my ring control, if i am selecting 3rd value THREE has to be stored in my char variable. If i select 2nd value is has to return TWO...

 

Can someone suggest...

0 Kudos
Message 1 of 9
(4,856 Views)

GetCtrlIndex + GetLabelFromIndex is the way I normally use for this.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 9
(4,853 Views)
Solution
Accepted by topic author ammukrish

Works Perfect.

Thanks Roberto

0 Kudos
Message 3 of 9
(4,846 Views)

Hello All,

do you know how to get values of a ring with double values ?

GetCtrlIndex returns an Integer : ok

GetCtrlValue requires an integer ???

 

[Ring type]: double

[precision]: 9                                            (0.000000000)

 

[Label]                           [Value]

Vaccum                      0.000005212

Air                               1.54856000

Glass                          3.55552500

 

 

Thanks in avance for your time.

 

 

0 Kudos
Message 4 of 9
(446 Views)

A bit of digging in the function tree would return GetValueFromIndex function. You will need to pass the pointer to a double variable to retrieve the correct value.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 9
(437 Views)

Oy Roberto,

thanks for advice.

Unfortunately the function requires à int value, the value in the ring is declared as double.

Somgthing wrong, in the use of this function?

 

int mode;
double valueB; 
.....

            GetCtrlIndex (pMaterials,MATERIALS_RINGMAT,&mode);   
            GetValueFromIndex (pMaterials, MATERIALS_RINGMAT, mode, &valueB);

ChicoBitao_0-1721640463114.png

 

Grazie mille !!

 


           

0 Kudos
Message 6 of 9
(427 Views)

GetIndexFromValue can treat whichever data type you want: the function evaluates at runtime the variables passed to it and throws an error in case of mismatch between actual control's data type and variable type. That is to say: either the ring control is customized for integers or the function is pointing to a different control than expected. May the panel handle refer to a wrong panel?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 9
(420 Views)

May the panel handle refer to a wrong panel?

 

Right Roberto, pointing to an old version of one *.uir file !!!!

 

! Thanks for sharing your expertise with casual CVI users.

 

Grazie mille.

VR

0 Kudos
Message 8 of 9
(357 Views)

Glad to have helped you.

 

To address this kind of problems I normally have some macros pointing to the correct .UIR files:

 

#define   UIRA   "myUIR_A.UIR"
#define   UIRB   "myUIR_B.UIR"

 

 

Later in the code I use the macros instead of actual .UIR filename:

 

panelHandle = LoadPanel (UIRA, ..., ...);

 

 

This way to update an .UIR to a new version I have only to change the macro (and the associated #include) without need to revise all the calls in the code.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 9 of 9
(342 Views)