LabWindows/CVI

取消
显示结果 
搜索替代 
您的意思是: 

getting label.value from ring control

已解决!
转到解答

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 项奖励
1 条消息(共 9 条)
6,123 次查看

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?
2 条消息(共 9 条)
6,120 次查看
解答
接受人 ammukrish

Works Perfect.

Thanks Roberto

0 项奖励
3 条消息(共 9 条)
6,113 次查看

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 项奖励
4 条消息(共 9 条)
1,713 次查看

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 项奖励
5 条消息(共 9 条)
1,704 次查看

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 项奖励
6 条消息(共 9 条)
1,694 次查看

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 项奖励
7 条消息(共 9 条)
1,687 次查看

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 项奖励
8 条消息(共 9 条)
1,624 次查看

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 项奖励
9 条消息(共 9 条)
1,609 次查看