Facing issue in creating typed variables

70 views
Skip to first unread message

Shivakrishna Koppolu

unread,
Apr 5, 2021, 7:36:36 AM4/5/21
to Blockly
Hi ,

When I try adding typed variables and save it am facing the below error.  Please help me in resolving this issue. And is there any way of changing the options style from radio to select dropdown list.

TypedVariableModal.js:175 Uncaught TypeError: blockly_core__WEBPACK_IMPORTED_MODULE_0__.Variables.nameUsedWithAnyType is not a function
    at TypedVariableModal.onConfirm_ (TypedVariableModal.js:175)
    at HTMLButtonElement.h (blockly.js:790)


Attached the screenshot also.


Capture.PNG

Abby Schmiedt

unread,
Apr 5, 2021, 2:20:57 PM4/5/21
to Blockly
Hello!

It looks like you might be on an older version of Blockly. This requires Blockly version '3.20200625.0' or higher. I would recommend updating if you can. If you can not, you would have to create you own implementation that changes this line to use the old method name `nameUsedWithAnyType_`. 

Regarding changing to a dropdown list: 
Yes, you can do so by creating your own class that extends the TypedVariableModal. I did this when I was testing out TypedVariableModal so an example that you can follow can be found here. It will end up looking like this:
Screen Shot 2021-04-05 at 11.11.43 AM.png
Since it was a test I didn't spend a lot of time on CSS so it might need some cleanup. You can also remove anything having to do with creating a random name. 

Hope this helps!

Abby

Shivakrishna Koppolu

unread,
Apr 6, 2021, 2:47:36 AM4/6/21
to blo...@googlegroups.com
Thanks alot Abby Schmiedt, it helped. 


With regards,
K.Shivakrishna.


--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/vrT9gYw733E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/5f6d765a-0418-450a-9fde-e5b38182be0en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages