How can you make a drop-down menu with a choice

How can you make a drop-down menu with a choice of parameters in the @SimpleFunction method, like in native blocks, for example, like here?

App Inventor does not have any drop-down menu options currently.

With Blocks

Others may have other ideas.

Thank you! But I mean the drop-down menu when creating an extension block, when writing in Java using the @SimpleFunction or @SimpleProperty method, so that there would be such a choice of block parameters, and not in the final application itself.

It is not possible to create extensions and components into which blocks are developed.

Ok, thank you!

In the next release of ai2, you will be able to create auxiliary blocks. I haven't looked into the documentation yet, but I think it will be possible to create constant values ​​with them.

Nice! Good news

Yes constant values only! The words that will be displayed in your dropdown and the backing value of that choice must be known at compile time =)

Good to see an extension developer with a use case for it! I hope you find it helpful once it's fully released :smiley:


Thanks for your feedback! Now my extension looks a little cumbersome and awkward, this option would make the use much more convenient.

Please tell me where you can find out about the appearance of this function?

In addition, follow the naming rules. The names of the input data in the functions start with a lowercase letter. Instead of "InputHexData" it should be "inputsHexData". I think you should also use "AesEcbNoPadding56" instead of "AES_ECB_NoPadding56" in constant values. In my extension, I used similar rules to you and was corrected.

Yes thank you. I was already told about this in the topic with the publication of the extension.