-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In a user-defined enumeration, the item is not selected with Blocks. #6037
Comments
Why JavaScript editor → Blocks editor Web browser console log:
more details When the function call log:
|
Suggest modifying the If it is only name, change to value+name.
|
FieldUserEnum
Describe the bug
No items are selected a user-defined enumerations of Radio Broadcast extensions and playground example.
playground example
On Blocks editor
![image](https://private-user-images.githubusercontent.com/2490958/262276092-63722165-ea28-4f68-82b3-5c72e017bb6d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTMzOTEsIm5iZiI6MTczOTU5MzA5MSwicGF0aCI6Ii8yNDkwOTU4LzI2MjI3NjA5Mi02MzcyMjE2NS1lYTI4LTRmNjgtODJiMy01YzcyZTAxN2JiNmQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDQxODExWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWEyNTRlY2YyNTFmZTYzYTI1NGM0NmFjZmRlMzdlNGYyODRjOThmODM2MDA2NmExNjgyMGYwY2Y0YmE3ZDJmNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.mWkGhpYBkdj0idE5pL75x8Wqt0wh6PahJb3YxMpxDYI)
Place the blocks as follows:
Member Red (=0) is not selected, but the display will be 0
JavaScript editor → Blocks editor
![image](https://private-user-images.githubusercontent.com/2490958/262276212-8296e190-861d-4b81-b270-f9eb2358bef7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTMzOTEsIm5iZiI6MTczOTU5MzA5MSwicGF0aCI6Ii8yNDkwOTU4LzI2MjI3NjIxMi04Mjk2ZTE5MC04NjFkLTRiODEtYjI3MC1mOWViMjM1OGJlZjcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDQxODExWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWNmYmQzZGM4YWE4Y2EzYzczMmQ5OTc5NTZiOTU3MDU2ZTk2NmI0Mjg4Mjg1N2IyZTAyODhkM2Y4NzI4NmM3NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.J9oPHTGQddA024Sl8tk32i8KFVacMBkKhcz6C_iYgeU)
On the JavaScript editor, code as follows:
When I convert to Blocks, it shows Red instead of Blue and nothing is selected.
![image](https://private-user-images.githubusercontent.com/2490958/262276323-056427e0-a8c5-482e-92e7-5490ce062598.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTMzOTEsIm5iZiI6MTczOTU5MzA5MSwicGF0aCI6Ii8yNDkwOTU4LzI2MjI3NjMyMy0wNTY0MjdlMC1hOGM1LTQ4MmUtOTJlNy01NDkwY2UwNjI1OTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDQxODExWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjFlMjU5NmNhZDQ5Zjg3ODkxZWNiZGRmMzEzMzQ3MmNmOGM2OWI1YWI5MzBhYzUzYmMzYTEwZDNhNzA0YjAyYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.K-jlpx0RPFCh9GlywEmBhxY1sSHxqxWRv54X9X34hOc)
However, since 1 is displayed on the simulator, it appears that Blue (=1) is selected internally.
It appears that internal values are retained when blocks are copied.
Additional context
value
The format of the name is 10mem, where "10" is the value and "mem" is the enumerated member.
Therefore, it is not hit by item selection and does not become selected.
https://github.com/microsoft/pxt/blob/master/pxtblocks/fields/field_userenum.ts#L152
menu generator
The fake line is called in the createMenuGenerator function.
https://github.com/microsoft/pxt/blob/master/pxtblocks/fields/field_userenum.ts#L62
The text was updated successfully, but these errors were encountered: