LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Get control ID from constant name

Hi,
I would like to get the ID of a userinterface control, but only the "constant name" is known information.
Is there any way to get it?
Regards,
0 Kudos
Message 1 of 4
(4,267 Views)
By ID, do you mean the value of the constant?
Why do you want it? The reason the constant names are used is that when the user interface panels are modified using the UIR Editor, the .h file is automatically updated. The user has no control over the values assigned to the constants. The values may change whenever the UIR is modified.
Since the constant represents a number, you can use the constant as you would a number, To see the value of the constant, you can do something as simple as
printf("The value of PANEL_MYCONTROL is %d\n", PANEL_MYCONTROL);
But again, I see very little reason to do this and real risks in doing this. The beauty of using constants is that you don't care and don't need to know the value.
0 Kudos
Message 2 of 4
(4,264 Views)

Instead of writing 10 similar functions, you could write one general function by pulling the control id programmatically. Since users can define the control name but not the control id, the control id must be determined programmatically.

0 Kudos
Message 3 of 4
(3,767 Views)

I think I never found myself in a situation that I would necessitate such a function. Can you elaborate al little more on your sentence, give some example?



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 4 of 4
(3,758 Views)