Warning: this is a short-term solution, it may cause interesting results in future versions of the webOS SDK, so use wisely.
A fix I’ve discovered is this simple CSS addition to any elements which need higher resolution mouse movement (er, touch movement, whichever):
Just put any valid CSS selector in place of “myelement” above, and you should notice a marked improvement in mouse movement precision for the element(s) in question.
This is not a future-proof solution, because if Palm’s webkit properly supports this CSS property in the future, your users will be dragging a shadowed version of the control around in ways you probably don’t want. Please be sure and test this with new SDK versions and be ready to take it out of your app at some point.
Continuing with my explorations in the webOS 1.4.5 SDK, I’ve picked out a couple of other useful calls to the PalmSystem object. Both can be added to the “hello world” example I started in part one, and they’re really quick.
A common requirement for mobile apps is the ability to respond to device orientation. I’m still digging around to see where you can hook into these events, but in the meantime here’s a simple call which is quite useful:
This tells webOS to let your app rotate along with the device orientation, switching from portrait to landscape as necessary. It’s a high-value one-liner call which should serve most orientation needs.
You can also specify a “locked” orientation with different strings in place of “free”. Options are: up (default portrait), down, left and right. So if you have a side-scroller game that would benefit from horizontal presentation, just use:
Step one: Make a web app and test it in Chrome or Safari.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Save this into a new folder (using a folder name of “hello” in this example) as index.html. This will become your app folder. You can test your app in Chrome or Safari by simply opening this file in your browser. Not terribly impressive, but hey, it’s a start.
Wasn’t quite ready to put this out into the wild, but then I didn’t exactly set it to “private” on GitHub, now did I?
Check out the docs at: http://joapp.com/jo
The current dev build (with docs and libs built) is available for download at: http://github.com/davebalmer/jo/downloads
And the source is available at GitHub as well (freeBSD license): http://github.com/davebalmer/jo
Have fun, and remember that the framework is working, but still under development. Please send me feedback (especially bugs).
One of the issues I’ve run into with this approach in the past is the CSS gets thick with, basically, lots of div tags with classnames like “menubar” and “group”. I found this can make for some difficult maintenance, especially when working on cross-platform apps.
Worse, one of the first real apps I’m building with the new framework includes a searchable, indexed set of its own documentation. Cute thought, but hurdle one was: how the heck do I pull in HTML doc files with their interesting (and possibly themed) CSS without creating odd interference with my UI controls?