Mobile Wondering <was Maximum field height?>
neville.smythe at optusnet.com.au
Mon Apr 6 13:50:27 EDT 2020
I had been wondering when the third-class status of mobile platforms in the LC world, particularly in relation to scrolling fields and groups, would crop up here.
Some time ago I looked at converting an iOS project to LC, and was appalled at the crude 1984-style appearance of scroll bars. I presume they look that way to inhibit their use, since the scrolling idiom on mobile platforms iOS is quite different from the desktop. But I reckon the native-scroller thingy which you had to use in its place seemed an awful hack: its appearance in a different layer meant other objects got overwritten in a completely unacceptable way (has that changed?); and the separation of the testing regime from the IDE turned back the clock on the development process, again to 1984 when you developed on the Lisa, tested on the Mac. (Yes, I was there!)
So I developed a custom scrollbar which worked on both desktop and iOS. It is doable, with a modicum of fiddly stuff.
1. An installer stack or widget. When you drag a scrollbar template onto a field (or group), it registers the field id with the scrollbar, snaps the scrollbar to fit the field dimensions with the desired vertical or horizontal orientation, and adjusts the thumb to match the field content. It also installs a backscript and frontscript in the stack.
2. The front script captures mouse events/ drag touch gestures intended for the field, filters for scrolling events and diverts those to the appropriate custom scrollbar. For 2-dimensional scrolling I used two separate scrollbars which needed some cross-mediation of gesture directions; a combined double-scrollbar would have been better.
3. The backscript catches changes to the field affecting content, position or dimensions which need to be reflected in the scrollbars.
I had it working pretty well, to the point of a mostly complete examples / installer stack . You can customise all sorts of things, such as the appearance of the thumb and scrollbar background, whether the thumb length should reflect field content proportionally or not, visible-on-demand or as-needed or hidden thumb, the number of thumb positions - for example you could have a stepper with just 5 positions and a custom image as thumb - and even have left side or top mounted scrollbars. You could even have a desktop look and feel if you wanted, and why not if Apple can flout their own UI guidelines?
The iOS project lapsed, running the maze of Apple distribution requirements became discouraging and I lost interest. But it can be done.
More information about the use-livecode