01-28-2015 08:34 AM
01-28-2015 12:02 PM
The "Command button" does just this. It's momentary.
Or if you prefer, you could use any of the "Toggle buttons" or "Binary switches" and get this behavior by using a combination of the EVENT_LEFT_CLICK and EVENT_LEFT_CLICK_UP. When you get the click up event, you could forcibly reset the switch control's position back to OFF.
01-28-2015 09:00 PM
Hi,
I followed using EVENT_LEFT_CLICK and EVENT_LEFT_CLICK_UP to light a LED.
But when I press the toggle button, the button did not respond properly. Some lag occur & button only depress when click on its label. Only when double-clicking the button, it will then depress.
switch (event)
{
case EVENT_LEFT_CLICK:
SetCtrlVal(panelHandle, PANEL_LED, 1);
SetCtrlVal(panelHandle, PANEL_TOGGLEBUTTON_2, 1);
break;
case EVENT_LEFT_CLICK_UP:
SetCtrlVal(panelHandle, PANEL_LED, 0);
SetCtrlVal(panelHandle, PANEL_TOGGLEBUTTON_2, 0);
break;
}
return 0;
01-29-2015 07:58 AM
Yes, that would be normal behavior for a Toggle button. Toggles are not momentary: they keep their state. But to get behavior you want, I've made you a sample project, with both Command and Toggle buttons: