Page 1 of 1

Created a livecode field that works with Android and Mobile

Posted: Wed Nov 11, 2015 2:36 am
by William Jamieson
Hey all just wanted to put this out to the community. I created a field a while back for my mobile applications that has a few unique behaviors.

1. It allows for rounded corners
2. The system doesn't autoselect the fields when you change cards on mobile causing your entire app to get pushed up
3. You can customize what filters to have on the field (example: email, numeric, letters only)
4. The color changes for when the field is highlighted
5. The size can readjust to the surrounding area when the user types meaning if the field has 1 line of text then it will be 40 px, but when the user enters more text and the field wraps, the size of the field extends to 80px rather than having it scroll. (On mobile there is almost no way to touch scroll a field so this avoids a pretty big problem.)

Anyways, play around with it, change the custom properties according to your wishes, and someone please turn this into a widget.

If not a widget builder then improve and give back to the community. Thanks.

-Will

Re: Created a livecode field that works with Android and Mob

Posted: Wed Nov 11, 2015 10:07 am
by Dixie
err... everything that you have outlined here, and an awful lot more, can be done with a 'native' field...
the properties associated with a native field :-

text, unicodeText,textColor,fontName, fontSize, textAlign, autofit, minimumFontSize, autoClear, clearButtonMode,borderStyle, editing, autoCapitalization, autoCorrection, manageReturnKey, keyboardStyle, keyboardType, returnKeyType, contentType, enabled, editable... dataDetectorTypes, selectedRange, contentRect, hSroll, vScroll, canBounce, scrollToTop, canCancelTouches, delayTouches, pagingEnabled, decelerationRate, indicatorStyle... the list goes on...

focus is determined using the action iphoneControlDo id, "focus" ....and in conjunction with using the messages that are sent, you can determine when the 'native' field should move when the keyboard appears

did they forget anything ?.. :-)

Re: Created a livecode field that works with Android and Mob

Posted: Wed Nov 11, 2015 4:53 pm
by FourthWorld
Perhaps a good direction for this would be to have the field instantiate its own native controls at runtime. I've been writing a library to do this for fields and other objects so I can both spend more time working directly in the IDE and also reuse more layout elements in both desktop and mobile. Such an approach gives the best of both worlds, LC fields which do a good job of providing common desktop behavior, and letting the OS provide appropriate behavior for the respective touch-based OSes.

With that in place, other aspects like filtering can be combined with specifying the mobile keyboard to be used for the appropriate entry type (email, numeric, etc.).

As I get more time to get back to my library I may be able to contribute any useful parts from that. Given the great support LC provides for mobile-native controls and that they're currently encumbered by having to script them rather than drag-and-drop them, I've been surprised that such a library isn't already shipping with LC. But at least this is something the community can do for ourselves, hopefully minimizing some of the coding we all do over and over for mobile fields, buttons, etc.

Re: Created a livecode field that works with Android and Mob

Posted: Sat Mar 12, 2016 11:07 pm
by William Jamieson
Yeah I agree, nothing can replace the native field behavior.

I hope LiveCode makes the native fields into widgets.

-Will