zuilin
October 14th, 2020, 06:58
I'm using a stringfield to have the user enter a string of text. I want to do something with it when they press <Enter>. However, what happens now is that when <Enter> is pressed, the text becomes highlighted.
I looked in the API and there is a onValueChanged() callback for stringcontrol which stringfield inherits, and the ref doc says:
Is called when the value of the string inside the control changes. This may result from finishing the editing of the string or the value changing externally from the control.
When I test this, every character entered into the stringfield triggers onValueChanged(), not just "...result from finishing the editing of the string..." like it says.
Two (ok, three) questions:
1. Is there any way to detect when <Enter> is pressed and then do something with the entered string at that moment?
2. If this isn't the control that can do this, but here is a better one, which one is it?
3. Is there some other means to accomplish this?
Thanks.
I looked in the API and there is a onValueChanged() callback for stringcontrol which stringfield inherits, and the ref doc says:
Is called when the value of the string inside the control changes. This may result from finishing the editing of the string or the value changing externally from the control.
When I test this, every character entered into the stringfield triggers onValueChanged(), not just "...result from finishing the editing of the string..." like it says.
Two (ok, three) questions:
1. Is there any way to detect when <Enter> is pressed and then do something with the entered string at that moment?
2. If this isn't the control that can do this, but here is a better one, which one is it?
3. Is there some other means to accomplish this?
Thanks.