Created a livecode field that works with Android and Mobile

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

Created a livecode field that works with Android and Mobile

Post by William Jamieson » Wed Nov 11, 2015 2:36 am

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
Attachments
Perfect Field.zip
(2.95 KiB) Downloaded 249 times

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

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

Post by Dixie » Wed Nov 11, 2015 10:07 am

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 ?.. :-)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Wed Nov 11, 2015 4:53 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Contact:

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

Post by William Jamieson » Sat Mar 12, 2016 11:07 pm

Yeah I agree, nothing can replace the native field behavior.

I hope LiveCode makes the native fields into widgets.

-Will

Post Reply