LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build a variable name programmatically?

Hello,

I have a program where several checkboxes, contained in a tab (constant name: TAB_Set), trigger the same callback function (function name: ChkDevice).

 

Within this function I would like to get the value of the triggering check using something like:

GetCtrlVal(tabHandle, TAB_Set_<control>,&on);

where <control> is automatically set when triggering the callback function.

Typically I have controlID of the form TAB_Set_CHK_Analyzer .

 

I have many devices linked to this CB function, so I would really appreciate to be able to generate the TAB_Set_<control> variable name automatically, without having to write thousands of GetCtrlVal(...) lines.

 

Is it possible to do so in LabWindows?

 

Thank you for your support and best regards,

 

Mat

0 Kudos
Message 1 of 3
(3,186 Views)

Sorry! It was a misunderstanding of mine:

I did not realize GetCtrlVal(tabHandle, control,&on); is already OK!

0 Kudos
Message 2 of 3
(3,178 Views)

Indeed, you can stick with the callback's control parameter.

 

Possibly another way to do what you're asking is to consider putting those controls into an array.  Then their individual IDs can be obtained by calling GetCtrlArrayItem.

 

This approach comes in handy when you're trying to access the controls outside of their callback, where you don't have the control ID parameter given to you.

0 Kudos
Message 3 of 3
(2,705 Views)