10-09-2015 01:23 AM
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...
Solved! Go to Solution.
10-09-2015 01:55 AM
GetCtrlIndex + GetLabelFromIndex is the way I normally use for this.
10-09-2015 02:21 AM
Works Perfect.
Thanks Roberto
07-19-2024 04:25 AM
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.
07-19-2024 10:03 AM
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.
07-22-2024 04:36 AM
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);
Grazie mille !!
07-22-2024 08:19 AM
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?
07-30-2024 11:36 AM
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
07-31-2024 04:13 AM - edited 07-31-2024 04:13 AM
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.