Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Web page seems backwards...

27 views
Skip to first unread message

Alan Smith

unread,
Dec 27, 2024, 11:33:17 AM12/27/24
to Blockly
I don't mean to ask a stupid question as I am just starting with blockly.

On this page: https://developers.google.com/blockly/guides/create-custom-blocks/procedures/creating-custom-procedure-blocks, it seems like you are supposed to have the field name first followed by the field value.

But the actual code looks like it is supposed to be the field value followed by the field name.

Am I misunderstanding something?

Thanks in advance,

Alan

Ronald Bourret

unread,
Dec 27, 2024, 1:21:47 PM12/27/24
to blo...@googlegroups.com
Hi! Welcome to Blockly!

Are you referring to the calls to Block.setFieldValue in Trigger rerendering on updates? If so, you are correct and the docs are wrong. The calls should be:

Blockly.Blocks['my_procedure_def'] = {
  doProcedureUpdate() {
    this.setFieldValue(this.model.getName(), 
'NAME');
    this.setFieldValue(
        this.model.getParameters()
            .map((p) => p.getName())
            .join(','),
        'PARAMS');
    this.setFieldValue(
        this.model.getReturnTypes().join(','), 
'RETURN');
  }
};

Note also that the last call to setFieldValue was missing a closing parenthesis.

Ronald Bourret
Technical Writer (Provided by Synergis)


--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/862dbadf-5c9c-4f4a-be43-aab9ee24bbefn%40googlegroups.com.

Alan Smith

unread,
Dec 27, 2024, 4:32:42 PM12/27/24
to Blockly
Yes.  Thanks for confirming (and for the warm welcome).

--Alan
Reply all
Reply to author
Forward
0 new messages