Hi,
The only on-screen-buttons that "acts" as long as they are being pressed are the jog-buttons. All other buttons, AFAIK, are "edge-triggered", they run the attached code once, every time they are being clicked. There's no way to "see" if it is being "held down".
For your latching LED example, if the LED is OEMLED1000 then you can do something like this:
Code:
If IsOutPutActive(Output1) Then 'Check the state of the output...
DeActivateSignal(Output1) '...if it's "on", turn it off...
SetUserLED(1000,0) '...and turn off LED
Else
ActivateSignal(Output1) 'Otherwise turn the output "on"...
SetUserLED(1000,1) '...and turn on the LED
End If
For the non latching version perhaps a time delay might be worth a shot, something like:
Code:
ActivateSignal(Output2) 'Set output
SetUserLED(1000,1) 'Turn on LED
Sleep(1000) 'Wait one second
DeActivateSignal(Output2) 'Reset output
SetUserLED(1000,0) 'Turn off LED
HTH