mobileControlCreate "input" - Setting the text to a field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

mobileControlCreate "input" - Setting the text to a field

Post by JereMiami » Sat Jan 09, 2021 2:43 am

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?

AndyP
Posts: 614
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

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

Post by AndyP » Sat Jan 09, 2021 11:51 am

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"
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 516
Joined: Fri Feb 24, 2006 9:45 am

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

Post by elanorb » Thu Jan 14, 2021 12:53 pm

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
Last edited by elanorb on Thu Jan 14, 2021 4:26 pm, edited 1 time in total.
Elanor Buchanan
Software Developer
LiveCode

JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

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

Post by JereMiami » Thu Jan 14, 2021 2:53 pm

Thank you!

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”