webOS Nation Forums >  Homebrew >  webOS Patches > Coding Help for Final Barrier of Alarm Clock Snooze Patch!!! Please Help
Coding Help for Final Barrier of Alarm Clock Snooze Patch!!! Please Help
Thread Tools Display Modes
Old 10/10/2009, 12:14 AM   #1 (permalink)
Posts: 219
So I have been trying to get this working for awhile and this is the last thing I need to get working for this patch to be fully operational. I am trying to use the ListSelector to pick a value in alarm-assistant.js then use that value in alarm.js in the same project. Please if you can help take a quick look and let me know.

This I how I setup my ListSelector command in snooze-assistant.js:

var AlarmAssistant = Class.create({
 snoozetimes: [
            {label:$L('5 Min'), value:"00:05:00"},
                {label:$L('10 Min'), value:"00:10:00"},
                {label:$L('15 Min'), value:"00:15:00"},
                {label:$L('20 Min'), value:"00:20:00"}
       setup: function() {
                //Snooze Widget
                this.snoozeselectorsModel={snoozeStatus: this.alarm.snoozetime};
                this.controller.setupWidget('snoozelength', {label: $L('Snooze'), choices: this.snoozetimes, modelProperty:'snoozeStatus'}, this.snoozeselectorsModel);
                this.controller.listen('snoozelength', Mojo.Event.propertyChange, this.snoozeChanged.bindAsEventListener(this));
snoozeChanged: function(e){
I believe I have that all set up correctly. everything in the UI works correctly and look right. but it does not seem like the values from the ListSelector are being set.

here is my code from alarm.js

var Alarm = Class.create({
        initialize: function(id) {
                                        snoozetime = "00:10:00";

        saveSnooze: function(snoozetime){
                this.snoozetime = snoozetime;

Alarm.kAlarmSnoozeDuration = this.snoozetime;
snoozetime does not take the variable from the ListSelector in the assistant file. What is wrong with my code? I dont know why the variable is not being stored or transfered over.

Thanks for the help

P.S. For a more complete look at my code check it out here

Last edited by elpollodiablo1; 10/10/2009 at 12:19 AM. Reason: added link
elpollodiablo1 is offline   Reply With Quote
Old 10/10/2009, 11:56 AM   #2 (permalink)
Posts: 219
I am guessing we don't have many developers here. I know this cant be that difficult to figure out.
elpollodiablo1 is offline   Reply With Quote
Old 10/10/2009, 12:51 PM   #3 (permalink)
Posts: 106
I think you have a conflict with the "this" keyword. It's bound to the function(snoozetime), and so the value is lost when that function ends.

Hope that helps...
linwiz311 is offline   Reply With Quote
Old 10/11/2009, 09:44 PM   #4 (permalink)
Posts: 219
Thanks I will look into this. once I figure this out my snooze alarm Patch will be alive!!!! If anyone else have any other suggestions, I would greatly appreciate them. I dont really know the whole javascript structure and how binding and "this" works. so more input is always helpful
elpollodiablo1 is offline   Reply With Quote
Old 10/29/2009, 10:07 AM   #5 (permalink)
Posts: 219
So I just found out that 2 days ago one of the developers at Palm decided to take this idea and implament it on his own. I will test it and try and make a patch for it. It actually seems like the code that is posted there is already in patch format. It is most likely that this will be in the next offical Palm Update.

Check it out if you want to try it on your own.
Palm Dev Clock Snooze Duration
elpollodiablo1 is offline   Reply With Quote


alarm, listselector

Thread Tools
Display Modes


Content Relevant URLs by vBSEO 3.6.0