07-30-2018 02:20 AM
11-18-2012 03:27 AM - edited 11-18-2012 03:27 AM
Hi. I use the LabWindows CVI and i want to turn the LED from yellow to red to green
i use
SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_ON_COLOR, VAL_YELLOW );
SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_ON_COLOR, VAL_RED);
SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_ON_COLOR, VAL_GREEN);
but it dosn't work
07-30-2018 02:40 AM
This may sound stupid, but did you turn the LED on since you modify the ON color?
SetCtrlAttribute ( panelHandle, PANEL_LED, ATTR_CTRL_VAL, 1 );
07-30-2018 02:53 AM
Yes i do
07-31-2018 09:19 AM
When you say it doesn't work, what is it that you see, exactly? Do you just see the led becoming green without going through the other colors?
Keep in mind that, under normal circumstances, CVI panels don't redraw themselves immediately, when you change a control attribute. They only redraw themselves the next time the user interface and has a chance to process system events -- this would likely happen when your callback function exits, or when you call ProcessSystemEvents, ProcessDrawEvents or GetUserEvent. So, if you want to see those other colors, you'll have to introduce a ProcessDrawEvents call in between your color changes.
Of course, even if you do that, you will only see a brief flash of those other colors. Is that your goal? If not, and if you would rather see those other colors for a longer period of time, you'll have to introduce some delay to the code.