LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with updating of a control in a panel

I would like start a procedure with an start button (CVICallback) and even I pressed this button in the Callbak function the Led is set to ON ( SetCtrlVal(panelHandle, PANEL_LED,1))and immediatly after this I start a timer and count some events. After them I clear the Led. I debugged them and the function is called and performed but in the panel the Led is never set. Why?
I do the same procedure with SetCtrlAttribute (panelHandle, PANEL_LED, ATTR_CTRL_VAL, 1); but it doesend work also. What is the Problem?
0 Kudos
Message 1 of 2
(2,623 Views)
If your code is included in a while loop, you must add some statements to let the system update the user interface.

If the problem is limited to updating some panel controls, you can simply add a ProcessDrawEvents () statement somewhere in your loop to let the control updates show.

In case you need to respond to some event while in the loop (e.g. some button press or else) you need to use ProcessSystemEvents () instead: this function updates the user interface and processes all events pending from when it was executed last time. It is a good practice to add this in long lasting loops to let the system process all the events.

Your code should look this way:

while (TRUE) {
// Your code here
ProcessSystemEvents (); //Let the system process

events
GetCtrlVal (panel, PANEL_STOP, &stop); // Test the stop button
if (stop) break;
// Test value of buttons, retrieve values of modified controls...

}

Another way of testing a stop button could be to create a specific callback for the button: inside the callback update a global variable and use this variable as a breaking condition for the test loop.

Hope this helps
Roberto


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 2 of 2
(2,623 Views)