LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT_COMMIT or EVENT_VAL_CHANGE

Solved!
Go to solution

I have a numeric control. When the value is changed from UIR I store the changed value in a global. Now the same control can be updated from another location. So lets say the control value was changed to 5. numGlobal = 5; I then read numGlobal and add 10 to it. Now the control should show 15. 

Should EVENT_COMMIT or EVENT_VAL_CHANGED be used? will the event needs to be swallowed after value is changed from control every time. Any suggestion how to achieve this?

TIA.

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 2
(3,310 Views)
Solution
Accepted by topic author lvrat

I don't exactly understand which is the problem.

Since your value is saved in a global variable and in the program you are manipulating it, you only need to reflect programmatic changes in the control, so a simple SetCtrlVal should be enough without need to use any particular event.

 

If on the contrary you have some reason to use the control callback (which may for example include other instructions you want to be executed when operating programmatic changes as well as when operating on the control) I suggest you to use CallCtrlCallback, passing the event you have coded in the control callback, this way:

 

 

double value;

GetCtrlVal (panel, control, &value);
value += 10;
SetCtrlVal (panel, control, value);
CallCtrlCallback (panel, control, EVENT_VAL_CHANGE, 0, 0, 0);

 

CallCtrlCallback is part of the Programmer's Toolbox.

 



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?
Message 2 of 2
(3,308 Views)