Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By _lele_
#79465 As per the subject:
Code: Select allmemclear
cls

print "Sample code for button press/release event capture"

wprint |<script>|
wprint |function ButtonAction(key) {|
wprint |  var xmlHttp = new XMLHttpRequest();|
wprint |  xmlHttp.open("GET", "msg?BA=" + key, false);|
wprint |  xmlHttp.send(null);|
wprint |  return xmlHttp.responseText; }|
wprint |</script>|
print
wprint |<button onmousedown="ButtonAction('*LEFT_PRESS')" onmouseup="ButtonAction('*LEFT_REL')">LEFT</button>|
wprint " "
wprint |<button onmousedown="ButtonAction('*RIGHT_PRESS')" onmouseup="ButtonAction('*RIGHT_REL')">RIGHT</button>|
print
button "QUIT", [quit]
print

msgbranch [steering]

[steering]
' code for steering here
print msgget("BA")
wait

[quit]
print "<a href='/'> Menu</a>"
end


This is console output:

Sample code for button press/release event capture
0 winsock connected 192.168.4.2
22
*LEFT_PRESS
22
*LEFT_REL
22
*LEFT_PRESS
22
*LEFT_REL
22
*RIGHT_PRESS
22
*RIGHT_REL
22
*RIGHT_PRESS
22
*RIGHT_REL
<a href='/'> Menu</a>
Done...
0 winsock Disconnected!


BTW, '22' is the line number of the blank line just before the [steering] label. Is this behaviour by design, a known issue or a bug?

Is there a way to suppress that line output to the console?