Keyboard reset text
Hi! It may be a simple question but not finding the solution despite of reading almost the whole documentation
I want to make the keyboard reset the "text" (from a dynamic text) so when I open the keyboard the text is empty and I can start writting from 0.
Right now the text starts with "Tap here and write anything!" and when you tap I made the following script:
//@input Component.Text textComponent
script.textComponent.onEditingStarted.add(doOnStarted);
function doOnStarted()
{
script.textComponent.text = "";
}
But when you write anyting it come from " " to "Tap here and write anything" again plus the letters you write. And I want to reset COMPLETELY the keyboard!
I hope you can help me!
Thanks in advance,
Ale
Answers
-
I was able to reset the text on the screen every time you click on the button "Tap to edit"
for the example "Click on button to edit [TRY ME]"
you can replace the following in the script Keyboard State Button.js
- enabledButton
- disabledButton
to this:
var init = function() {
script.text.onEditingFinished.add(function() {
script.getSceneObject().getComponent("Component.Image").mainMaterial.mainPass.baseTex = script.enabledButton;
});script.text.onEditingStarted.add(function() { if (script.text.text !== "") { script.text.text = ""; // Reset the input by setting the text to an empty string checkInputs(); // Reset the checkInputs function } script.getSceneObject().getComponent("Component.Image").mainMaterial.mainPass.baseTex = script.disabledButton; });
};
I wasn't able to detect the input for text I hope that helps!
1 -
@Tariq B said:
I was able to reset the text on the screen every time you click on the button "Tap to edit"for the example "Click on button to edit [TRY ME]"
you can replace the following in the script Keyboard State Button.js
- enabledButton
- disabledButton
to this:
var init = function() {
script.text.onEditingFinished.add(function() {
script.getSceneObject().getComponent("Component.Image").mainMaterial.mainPass.baseTex = script.enabledButton;
});script.text.onEditingStarted.add(function() { if (script.text.text !== "") { script.text.text = ""; // Reset the input by setting the text to an empty string checkInputs(); // Reset the checkInputs function } script.getSceneObject().getComponent("Component.Image").mainMaterial.mainPass.baseTex = script.disabledButton; });
};
I wasn't able to detect the input for text I hope that helps!
Man! Thank you so much, I needed a MVP to make the keyboard work and it was enough, but the next time I'll face the keyboard issue I'll follow along your advices and hope it can make it work better than mine!
0 -
Hi @Alexplorins I am happy that I was able to solve your problem
0
Categories
- All Categories
- Snap AR | Categories
- 2.4K Lens Studio
- 228 Camera Kit
- 27 Spectacles