Page 1 of 1

mobileControlCreate "input" - Setting the text to a field

Posted: Sat Jan 09, 2021 2:43 am
by JereMiami
This is android.

I have been using regular text fields that on mouseDown, if the text field is not empty, it enables a button to submit the text. No problem.

But ... I really like the native mobileControlCreate "input" widget. Mostly because of text correct, predictive text, and the ability to move the cursor with the spacebar (apparently you can do that now on android). So, how would I enable a button when text is entered into native input widget? How do I get the widget's text into a field? I sup

For instance, could I script to enable the button when the user hits the native "Done" button on the native android keyboard?

Re: mobileControlCreate "input" - Setting the text to a field

Posted: Sat Jan 09, 2021 11:51 am
by AndyP
You can use

set up a global var

In the script of the widget put

Code: Select all

global gMyText

Code: Select all

on textChanged
put the text of me into gMyText
end textChanged
then gMyText will be available as long as global var is declared in the script of the control where it is being used

or in the button

Code: Select all

get the text of widget "myWidget"

Re: mobileControlCreate "input" - Setting the text to a field

Posted: Thu Jan 14, 2021 12:53 pm
by elanorb
Hi JereMiami

If you are using text entry controls created with

Code: Select all

mobileControlCreate
you might find the

Code: Select all

inputTextChanged
message useful.

This message is sent when the content of a mobile text input control has changed. You can check the text and enable or disable your button based on whether it is empty or not.

I hope that helps.

Kind regards

Elanor

Re: mobileControlCreate "input" - Setting the text to a field

Posted: Thu Jan 14, 2021 2:53 pm
by JereMiami
Thank you!