Controls on mobile apps - am I missing something?

Richard Gaskin ambassador at
Mon Jun 27 14:41:23 EDT 2016

Ben Rubinstein wrote:

 > My previous mobile app dabbling had involved entirely custom
 > interfaces. Now I'm trying to create a more straightforward app
 > with a more conventional interface - and I'm getting a horrible
 > dichotomy between the widgets (header bar, navigation bar, switch
 > control, segmented control) and the traditional controls (radio
 > buttons, sliders, progress bars, etc).  The latter look fine
 > on Mac; but on iOS, they've gone back to Motif, which is to say
 > several decades.

iOS does not contain the APIs to render Mac controls, so LC defaults to 
its built-in Motif emulation.

Most desktop controls are unsuitable for use on mobile anyway, so using 
the types of mobile controls users are accustomed to is a better bet.

Buttons are buttons, of course, and you can get very good appearances by 
just changing the style to rectangle or roundRect, with whatever 
background and hilite colors compliment your app's appearance.

Radio control take up too much space on small devices.  More commonly 
pick lists are used, and LC provides commands to instantiate OS-native 
pick lists on mobile.

The closest fit for a radio control on mobile might be an option 
control, which is what I use as the on-screen control the user clicks to 
bring up the pick list.

For those, and editable fields and scrollers, it took me about 10 
minutes to find the process of scripting the instantiation of their 
mobile-native counterparts tedious to the point of feeling silly.  So 
instead I wrote a backscript that catches preOpenCard to do my 
instantiation for me.

My lib examines the controls on the card and then calls 
mobileControlCreate as needed, making editable text fields, scroll 
interaction overlays, etc. as needed.

Once I figured out that scrollers for fields are actually MUCH simpler 
than the LC Lesson for that suggests, getting the basic functionality in 
place took just a couple hours.  In fact, given how liberating it is to 
be able to use LiveCode objects on the desktop and have a lib 
automatically take care of replacing them with their mobile-native 
counterparts, even mapping relevant messages between them so I don't 
need to write as much platform-forked code, I've been surprised this 
isn't included with LC itself.

I'm still making lots of changes to my lib as I work toward deployment, 
so it's not yet in a sharable state.  When it is I mkay dual-license it, 
but I hope by then LC will just have something like this in the install; 
most devs I've talked to have already written their own variants of 
this, and like most things the code isn't the hard parts, it's designing 
how it should work.  Maybe one of the many others in our community is 
already shared and usable....

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  Ambassador at      

More information about the Use-livecode mailing list