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
Display variable type on dynamic getter and setter blocks #865
Comments
Corollary of (3): Develop new set of connector shapes that suggest type. I bet this isn't an option, but can't convince myself why not. Also to (3), icon means image, which means alt text for accessibility, which means same API and internationalization questions as (1). |
Shaped connectors are feasible, but add a lot of additional complexity, especially if you're allowing for custom shapes.
So they're out of scope for us short term, but something we could revisit later. |
I can convince you why not! Shapes work for a limited number of types, but break down quickly when we have more types. They need to be increasingly complex, but that can be hard to distinguish, especially as you zoom out. There's just not a lot of room there for distinctive rendering. They're also hard to use when a connector can take multiple types (e.g. you can print a string or a number: what shape is the connector?). RE: icons requiring alt-text: yes! Thanks for pointing that out. |
@rachel-fenichel |
The variables.js use a prompt input , it has no ability to chose a type. |
it must a large list in c# or java like language. |
I have finished most of this work. |
We do not plan to support changing the type of a variable after creation. |
Moved this to samples as we don't want to add new blocks to core. |
The problem
The proposed dynamic variable getter and setter blocks (see google/blockly#1281) don't display the type of the selected variable, which will be confusing for users.
Possible solutions
1
Add dynamically update the text on the block to include the variable type (e.g. 'set string ___', 'set number ____', etc.).
We would have to consider internationalization implications.
This works for arbitrary numbers of variable types, but can make the blocks hard to read for users who aren't used to typed variables. They may see the variable type as a noun instead of an adjective, which will break the flow of the sentence.
2
Change the color of the block based on the type of the variable.
This would probably only work for a limited number of variable types, and could lead to confusion if there are conflicts with the colors of other categories of blocks. We could allow developers to specify colors for each type, but that requires an additional API.
Developers can accomplish the same thing by creating a similar block and adding an onchange handler with a lookup table for the colour, or by creating multiple getters and setters (one per variable type) with different colours for each block.
3
Add an icon to the block, and have it change based on the type of the variable.
This would require developers to specify icons per variable type, which requires an additional API.
Developers can accomplish the same thing by creating a similar block and adding an onchange handler with a lookup table for the icon, or by creating multiple getters and setters (one per variable type) with different icons on each block.
The text was updated successfully, but these errors were encountered: