I have small problem about blockly.
I need to call some event (for example alert('hello world')
) when someone blurs text input.
I used Blockly.addChangeListener
, but this function is not called when someone create blur event on text input.
I have small problem about blockly.
I need to call some event (for example alert('hello world')
) when someone blurs text input.
I used Blockly.addChangeListener
, but this function is not called when someone create blur event on text input.
You can create an onchange
event for your input Block. Something like this:
onchange: function(event) {
var text = Blockly.Javascript.valueToCode(this, 'textBox', Blockly.C.ORDER_ATOMIC);
if (text == "") {
alert("Hello world");
} else {
alert(text);
}
}
where this
makes reference to your input Block and textBox
makes reference to the name that you have set to yours input box.