Pop Ups + text and mouse inputs #282
Replies: 5 comments
-
Posted at 2014-06-16 by @gfwilliams Hi, Popups are a bit tricky because as the code runs on Espruino, there's not a clear path from Espruino back to the UI. You could however do something like It's also made a bit more difficult in chrome web apps because for some reason you're banned from using In a way it might be nicer to make terminal.js handle the VT100 character colour commands, and then you could just display the message in the terminal. As far as accepting input in the terminal, if you're trying to do that in Espruino itseslf you've got to move the original terminal out of the way, and write your own handler for characters:
Note the "\3" check, which checks for Ctrl+C so you can break out of it. For mouse input, you'd have to check on the Blockly forums. There are already handlers in terminal.js (the terminal area) for mouse clicks and stuff, so you could potentially add something to those... Maybe even sending the VT100 escape codes, which you could then detect on Espruino with the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-16 by rsm Thanks Gordon. I tried your getInput() function and it complains that LoopbackA is undefined. Cheers, |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-16 by DrAzzy
Are you using version 64? The loopbacks were just added in v64. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-17 by rsm Thanks DrAzzy. Upgrading the version solved the problem. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-17 by @gfwilliams If you create a function called Or are you after something in the web ide? I'd imagine you're better just tacking the code to the front of whatever you send from blockly... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-06-13 by rsm
Hi,
I'm writing some Blockly Blocks and would like to alert the user when they do something bad (e.g. try to move a servo beyond its limits). Can I have the code generate a pop up when this happens? Something like
or
?
Also, how do I accept text input on the terminal side of the Chrome IDE? I know I can input JavaScript functions there, but what about text strings? If not possible, then how do I write my own function that will be recognized there, so the user can type "hello" and it executes the function
Finally, is there any way to accept a mouse input? e.g.
Thanks,
Rehman
Beta Was this translation helpful? Give feedback.
All reactions