Re: Ignoring unknown tag: shadow

19 показвания
Преминаване към първото непрочетено съобщение

Beka Westberg

непрочетено,
29.11.2021 г., 14:30:5429.11.21 г.
до blo...@googlegroups.com
Hiya James!

Looks like you've pretty much got this figured out =) You just need to change `callBlock.appendChild(shadowBlock)` to `value.appendChild(shadowBlock)`, because shadows need to be associated with an explicit connection.

I hope that helps! If you have any further questions please reply!
--Beka

On Mon, Nov 29, 2021 at 6:50 AM James Smith <j.s...@pi-top.com> wrote:
HI
I'm trying to add a shadow block in a dynamically created toolbox category.

I have plenty of shadow blocks in the toolbox categories that are not dynamic,
I have plenty of  dynamic toolbox categories without shadow blocks that work fine

but when I add a block with a nested shadow block in the dynamic category I get the error

Ignoring unknown tag: shadow

here's a snippit of my code:

  function populateCallable(procedureList)
  {
      const callBlock = Blockly.utils.xml.createElement("block");
      callBlock.setAttribute("type", "pi_call"); /* my custom block */
      callBlock.setAttribute("gap", "16");
      /* ... code cut for conciseness */
      const value = Blockly.utils.xml.createElement("value");
      value.setAttribute("name", "ARG0");
      callBlock.appendChild(value);
      const shadowBlock = Blockly.utils.xml.createElement("shadow");
      shadowBlock.setAttribute("type", "logic_null");
      callBlock.appendChild(shadowBlock);

      xmlList.push(callBlock);
    
  }


Is it possible to add shadow blocks in dynamic categories or am I just doing it wrong?

Many thanks
James

--
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 on the web visit https://groups.google.com/d/msgid/blockly/3096cb54-5c64-4fc6-a406-67bfe947a6d0n%40googlegroups.com.
Отговор до всички
Отговор до автора
Препращане
0 нови съобщения