A way to disable editing on statement inputs

60 views
Skip to first unread message

Francisco

unread,
Jan 28, 2026, 3:06:44 PMJan 28
to Blockly
Hi all,

I'd like to know if it's possible to disable editing on a specific input in a block, instead of disabling the block whole using this.setEditable(false)
const input = this.appendStatementInput('DEF')
input.appendField('function')
input.connection?.setShadowState({
  type: 'function_call' // preview of the block (similar to mit's scratch!)
})

The purpose here of the non-editable statement input is that it only holds a shadow-state of the function call preview, similar to how it's done in mit's scratch:

Screenshot 2026-01-28 195558.png

and use the next statements below the block as the actual function body :D

Aaron Dodson

unread,
Feb 2, 2026, 1:52:30 PMFeb 2
to Blockly
Hi,

To double check, your goal here is to prevent the shadow call block ("block name (number or text) <boolean> label text") from being replaced by another block without disabling the "define" block? If so, I think the easiest way to enforce that would be to use the connection checker mechanism. The shadow call block's definition would need to call this.previousConnection.setCheck('shadowdef'), and in turn the define block's definition should call this.inputList[0].setCheck('shadowdef'). That will enforce that only shadow call blocks are allowed to connect to the statement input in the define block. 

If I'm misunderstanding the question or you run into any issues with that, please let me know!

- Aaron
Reply all
Reply to author
Forward
0 new messages