-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Create setter blocks that select from a list of values #195
Comments
This is the same as issue #155 |
Hi! I would like to try to implement this, as it is already implemented in Espruino Web IDE. I need this in my fork. Which Blockly version are we used? Is it clean or patched by the AI team? |
@fmntf @afmckinney @jisqyv @NeilFraser There are some non-obvious aspects to what needs to be done here. For example, the block that sets the value of a property will mostly be choosing from a fixed set of values and the dropdown is perfect for that. But users also need the ability to set the property to the result of an expression, so a dropdown of fixed values is not sufficient. |
Hi @halatmit. Espruno propose a fixed list of values on a dropdown menu, but it allows to delete the dropdown and plug other blocks (like variables or procedure calls). See this screencast. Do you think it would be enough? |
@fmntf |
Hi. As said in Google Groups I have started to implement this feature on the UDOO branch. You can see the result here. Some useful features could be:
For 1), it is done in other parts, like logic_negate
but I have no idea on how to do this on For 2), I did not find anything similar in AI. I tried add a changed listener but I don't know Blockly internals to go on. @NeilFraser do you have suggestions? Thank you! |
Hi @halatmit @NeilFraser I need some feeback to go on, to understand if I'm taking the right direction. Advices on how to implement some protection logic (see the first point in the previous post) are also welcome! Thank you, |
Franceso, The video looks great. But it's hard for me to review the code unless you Paul: Comments? == Hal Abelson On Tue, Jun 23, 2015 at 4:16 AM, Francesco Montefoschi <
|
I didn't see anything in the video showing the new property editor in the designer that you would use for specifying that this is an 'enum' type of property. You would associate that property editor with properties that want to use it via the editorType attribute of the DesignerProperty annotation on the property. Presumably in such an editor you would enable the user to specify a set of name/number pairs which would constitute the allowable dropdown options (i.e the names) and their corresponding numerical values. Once you know those you can do type checking and type conversions. |
Good job getting it this far. In the long run, it will be important that these blocks are generated based on information passed in from the designer. Creating lots of single purpose blocks like "arduino_pin_mode" and "arduino_pin_value" will be harder to maintain. Instead, as Mark said, marking properties as having drop downs, and using that drop down information to generate the block will make it possible to easily add these types of blocks for new components. |
Thank you for your feedback! I think there are two different cases. The first is about properties values (and it is related to issue #195) - we should make users able to select properties values from the blocks editor. For properties values we should probably generate Blockly code starting from |
@mark-friedman I totally agree. I have created a separate bug: #432. Thank you! |
I believe that the helper block functionality implemented by Beka addresses this issue. |
Implement property setters that choose from a selection of values. For example, the setter for screen.alignvertical should allow only top, center, and bottom. This could be implemented with a new kind of block that incorporates a dropdown. Make sure the dropdown uses the list-of-pairs method to accommodate internationalization.
Implement a new property editor type that generates this block from a list of values, coordinated with the way these appear in the designer.
We need to also keep the current version of the setters, for when the argument needs to be computed. We should probably make a way to morph one form to the other, or make selecting from the dropdown do the transormation between forms.
After this is done, we can update some of the existing setters so that they use this.
The text was updated successfully, but these errors were encountered: