Constraining an input field's contents to be a single line.

Richard Gaskin ambassador at fourthworld.com
Thu Sep 21 11:14:33 EDT 2017


Alex Tweedly wrote:
 > I do not currently have "mobile text field objects" - all I have
 > are just standard LC fields, so returninfield is all I need for
 > the 'return' part of the problem - no need for 'inputReturnKey'.

If this is just for yourself then the following may not matter much, 
since you know what to expect and can handle whatever you choose to make.

But if this app is for others to use, using a LiveCode-native field 
instead of a mobile-native field will very quickly show why 
mobile-native fields are important.

Ideally of course, given the central role editable text plays in apps, 
there would be just one object that can work in the IDE and on the device.

And fortunately that was funded a while back:

Infinite LiveCode: Native Field Object
https://livecode.com/project/infinite-livecode-native-field-object/

IIRC that completion is dependent on the completion of some other 
aspects of LCB which are still being refined, so in the meantime we need 
to work with what we have, weighing the tradeoffs between LC-native 
fields and mobile-native.

The biggest is how selection is handled.  LC-native fields will bring up 
the device keyboard when entered, and you can type into them.  But 
that's petty much it.  Designed as they were for the desktop, selection 
is fundamentally different.

The mobile-native text editing experience users are accustomed to allows 
them to drag-select text, or long-press to select a word, and once a 
selection has been made handle controls appear at each end of the 
selection run, which can be dragged to adjust the selection.

There's also a popup panel that the OS provides when a text selection is 
active in a mobile-native field, offering a menu of options for common 
commands like Cut, Copy, Paste, Select All, and sometimes Search and others.

When attempting to emulate mobile-native fields using LC-native fields, 
you'll have to make all of those UI elements from scratch.  And since 
clipboard control is not currently supported by LC on mobile as it is on 
the desktop, any sort of copy and paste that would work between apps as 
users expect would be difficult if not impossible to achieve.

But when using a mobile-native field, you get all that for free.

For a brief while I once considered trying to come up with a framework 
for emulating mobile-native fields with LC-native fields.  It was 
daunting enough to deal with the tedium of crafting the selection 
handles, and the absence of integrated clipboard support ultimately 
prompted me to stop and put my time into more productive tasks.

You're a very talented and nimble thinker, but I suspect you'll find 
that until we get one field control that works in both the IDE and on 
mobile devices, you'll have a much better time focusing on ways to use 
mobile-native fields.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list