question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field.text_: Documentation vs use

See original GitHub issue

Our documentation is very clear about not using Field’s .text_ property.

“Warning: Never access the text_ property directly, instead access it through getText. It is maintained for backwards compatibility.” “Caution: Never use the text_ property to access or edit the text of your field. It is maintained for backwards compatibility.” https://devsite.googleplex.com/blockly/guides/create-custom-blocks/fields/customizing-fields/creating

“We recommend that you never access or update the text_ property of your field directly.” https://devsite.googleplex.com/blockly/guides/create-custom-blocks/fields/customizing-fields/upgrading

Yet our codebase uses it all over the place:

  • Blockly.Block.prototype.toString
  • Blockly.FieldAngle.prototype.onMouseMove
  • Blockly.FieldDropdown.prototype.doValueUpdate_
  • Blockly.FieldImage
  • Blockly.FieldImage.prototype.initView
  • Blockly.FieldImage.prototype.setAlt
  • Blockly.FieldTextInput.prototype.doValueUpdate_
  • Blockly.FieldTextInput.prototype.showPromptEditor_
  • Blockly.FieldTextInput.prototype.widgetDispose_
  • Blockly.FieldVariable.prototype.doValueUpdate_
  • Blockly.FieldVariable.prototype.refreshVariableName

Is .text_ a fundamental part of fields that needs to be used whenever one creates a new field?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
samelhusseinicommented, Aug 9, 2019

Thanks for bearing with me @BeksOmega. First off, I’d very much appreciate a demo. My reservation with making this generic has been to not end up with a solution that’s pretty much the same as what we have with this.text_ just renamed to a displayVaue or a tempValue.

Allow fields to display values that are different than their actual values in a generalized way.

I think that’s a great idea, instead of having the field_textinput have to set the this.text_ field directly in order to “hack” the field sizing, providing a more generic way to replace what is shown in the display would be great. I don’t see how you can do that with a single property on the field (unless that property is a DOM element), but please feel free to go ahead with a demo, I think that will give me a much better idea of your proposal.

0reactions
samelhusseinicommented, Sep 23, 2019

Documentation updated and will be published in the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TextField | Apple Developer Documentation
In the same context on iOS, the text field uses either the prompt or label as placeholder text, depending on whether the initializer...
Read more >
Field Types - DocuSign Support
You use the Initial and Sign Here fields for their initials and signature, and the Text field for the delivery location.
Read more >
<input type="text"> - HTML: HyperText Markup Language | MDN
The value attribute is a string that contains the current value of the text entered into the text field. You can retrieve this...
Read more >
Text type family | Elasticsearch Guide [8.5] | Elastic
Text fields are not used for sorting and seldom used for aggregations ... same way as a text field that only indexes documents...
Read more >
How to Use Text Fields - Oracle Help Center
This Swing Java Tutorial describes developing graphical user interfaces (GUIs) for applications and applets using Swing components.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found