Microsoft MakeCode

Creating an multi handler function in an extension

Hello everyone, I am trying to create a new block using an extension. I want the block to handle more the one handler, an example for it can be the if+else block in the logic section.

*At first I need it to handle only 2 handlers(like if+else), but it would be even better if it was expandable(like the if).

image

Does anyone know how to make it happen?
*A code of the “if” block by MakeCode as in the photo would help me a lot.

Thank you.

2 Likes

@Ronzi It is expandable


Press the plus button to make it expandable.
image

This may not solve your problems, but the MakeCode playground is a great tool to explore the block styles and prototype blocks. See: https://makecode.com/playground .

About the closest example is has is the in-line event handler.

2 Likes

Unfortunately I couldn’t find it there.
Thank you for your answer though.

yes, I am aware of that. My question is how I make a block that acts in that way(In an extension).

@Ronzi We don’t have a way to do this, the if-block is special. If you want, you can open an issue for this on our GitHub: https://github.com/microsoft/pxt-arcade/issues

Ok, great.
Thank you very much.