09-03-2013 09:37 AM
hi
i have declared a same callback function (edit control << call back function) for few controls (x,y,z) in the *uir file.
am able to execute the same callback function when the control is operated. but i am unable to find which control is operated (either x, y or z)
please suggest a solution
regards
phani
Solved! Go to Solution.
09-03-2013 09:41 AM
switch (control) {
case PANEL_COMMANDBUTTON:
break;
case PANEL_NUMERIC:
break;
//... and so on
}
09-03-2013 09:58 AM
this code looks like after knowing control is opearated, we can implement this. but how to know which control is operated.
For example
we have controls name x,y,z with same callback funtion "xyz"
if any of the control is operated, the "xyz" function is going to execute. at the point i would like to know which contorl is operated. either x, either y or either z.
09-03-2013 10:55 AM
Seems you are missing some basic concept on CVI callback mechanism.
When executing, each callback function receives some parameters that you may want / need to use in your code. Specifically:
- 'panel' parameter holds the handle of the panel the control is on
- 'control' parameter is the ID of the control that issued the callback
That is: whichever control is calling the callback, you may test the value of 'control' parameter at callback beginning and decide what to do based on this value. The control ID can be identificated based on the PANEL_CONTROL constant names you assign in the UIR editor, which is automatically generated and stored by CVI in the include file associated to the UIR file.