webOS Submit on Enter

Tuesday August 24th 2010, 12:12 pm
Filed under: Palm,webOS

Palm webOS Submit TextField on Enter
webOS Button widgets are cool, but they are HUGE!  In most cases, I hate sacrificing the screen real estate required to add a Button just to submit a TextField on a Scene.

So if you want to skip the button and process the input when the user hits enter, how do you make that work?  The webOS documentation doesn’t really make this clear or obvious.

I found this cool little trick on webOS 101, but the problem I ran into was that my “keyupHandler” function then did not have access to the TextField value.  “keyupHandler” is now scoped to this.controller.document and I wasn’t able to get back to this.controller.   The code below doesn’t work:

MyProgram.prototype.setup = function() {
    this.txtModel = { value: "", disabled: false };
    this.txtAttr    = { multiline: true, enterSubmits: true };
    this.controller.setupWidget('txtField',
        this.txtAttr,
        this.txtModel
    );
    this.controller.document.addEventListener("keyup",
        this.keyupHandler,
        true
    );
};

MyProgram.prototype.keyupHandler = function() {
    var text = this.txtModel.value;
};

I kept getting a “cannot get value of undefined” error. So firing the “keyup” event from this.controller.document changes the scope of the handler function? Maybe somebody with more Javascript skillz than me can comment on that…

But I knew there must be a better way… a more “webOS way”…

An itty-bitty little blurb in Frank Zammetti‘s excellent book Practical Palm Pre webOS Projects mentioning the requiresEnterKey attribute. Aha! “… will make the user have to press the Enter key… to fire the Mojo.Event.propertyChanged event”. Sweet! Now I can detect the enter key because it is the only key press that will fire an event in the TextField. The code below does the trick:

MyProgram.prototype.setup = function() {
    this.txtModel = { value: "", disabled: false };
    this.txtAttr    = {
        multiline: true,
        enterSubmits: true,
        requiresEnterKey: true
    };
    this.controller.setupWidget('txtField',
        this.txtAttr,
        this.txtModel
    );
    this.controller.listen("txtField",
        Mojo.Event.propertyChange,
        this.submitHandler.bindAsEventListener(this)
    );
};
MyProgram.prototype.submitHandler = function() {
    var text = this.txtField.value;
};


Favorite webOS Applications

Sunday March 28th 2010, 12:11 pm
Filed under: Palm,webOS

Everybody else gets to make these lists — why can’t I?

I’m a webOS noob, so I’m sure this list will need updating soon.

UPDATE: this post is only a few hours old, but I’ve already got a new favorite app:

CowTasks

Switching from Android to Palm, I was disappointed to find that Remember the Milk did not have a webOS app. I mean, they have an app for every other platform, plugins galore, etc. Why no webOS app??? Their touch-enabled mobile webapp (http://m.rememberthemilk.com) works pretty well, but you can’t get native notifications on the phone.

But d0lph1nK1ng has done a real nice job building an app from RTM’s API. His app is called CowTasks and it’s got just about everything the Android app does.

CowTasks

CowTasks

Tweed

Definitely the best Twitter app for webOS. 99 cents but worth every penny. Upload pictures, shorten URLs, everything you would expect from a full-featured Twitter client.

Tweed

Tweed

QR deCODEr

QR Codes are cool and this little app does a great job of decoding them.

QR deCODEr

QR deCODEr

DirecTV

A must for any DirecTV subscriber. Sure you can do all this from DirecTV’s mobile site, but a native app just makes it that much easier.

DirecTV

DirecTV


DirecTV Search

DirecTV Search

OpenTable

OpenTable isn’t as prevalent here in Salt Lake City as it was in New Orleans, but a very well done app anyway. Check it out if OpenTable is big in your town!

OpenTable

OpenTable

Engadget

Ok, there are a hundred different ways to get your Engadget fix on a mobile device, but this little app is pretty nice!

Engadget

Engadget

Backgrounds

One of my favorite apps on Android — glad to see he’s got a webOS version too.

Backgrounds

Backgrounds

Expanded reviews coming soon!



webOS Email Fail

Sunday March 28th 2010, 11:24 am
Filed under: Palm,webOS

I made the jump from Android 1.5 on a Samsung Moment to webOS on a Palm Pre, as I discussed here, mainly for webOS’s rockin’ email support.

I’ve had my Palm Pre less than a week now and I’ve suffered TWO email meltdowns.

The first time I let the battery die completely one night and when I charged the phone back up and tried to start up the email app, I was met with a blank white screen. I killed the email app, restarted it, and got another blank screen. I went into ‘Preferences and Accounts’ and saw no accounts listed! Not good. I tried to re-add my Gmail account — put in my credentials and hit ‘Sign In’ and it just sat there spinning. I finally killed it and tried again with my work Gmail account — same thing.

At that point I had only had the phone a few days, so I said screw it and decided to try a reset — “Erase Apps and Data”. This is actually a pretty slick feature since just about everything on the phone is backed up to your “Palm Profile”. The phone came back up after a few minutes and said it was restoring my apps and data. Nice! ( Yes, it restores apps you’ve purchased through the catalog too, but did not restore any “homebrew” apps I had installed. No biggie, I’ve still got the ipk’s on my computer. )

I had to re-enter the passwords for my email accounts, but they came right back up and worked great. Whew… hope that never happens again…

But it happened again yesterday! This time the battery was down to about 10% ( I only mention that because I was convinced that the first cataclysm happened because I let the batter completely die ). Same issue — blank white screen when I tried to start the email, couldn’t re-add the accounts, etc. Sigh… time for another reset.

How often is this going to happen?

This thread in the Palm forums makes me think that this problem was introduced with the webOS 1.4 update. Hope they are working on a fix!

At the end of this thread a user claims that Palm Tech Support is requesting log files from users with the problem. I’ll have to remember to check my log files before resetting if it happens again.


 






Copyright © Matthew Anderton, All Rights Reserved
Wordpress Themes (Naples News)