Results 1 to 7 of 7
  1.    #1  
    Hello,

    I have a problem. In my app preStop I want to have a small dialog to quick give trainings a name. I just took a look at Palm great examples. Well in my case nothing happens and I don't know what I did wrong.

    Here is my Code:

    Code:
    StopwatchAssistant.prototype.saveButtonPress = function(event){
    	//this.vibrate(300);
    	//this.StoreWorkout();
    	
    	this.controller.showDialog({
    			template: 'dialogs/sqlsavename',
    			assistant: new SqlSaveName(this, this.callback.bind(this)),
    			preventCancel: true
    	}); 
    }
    
    StopwatchAssistant.prototype.callback = function(value) {
    	//this.controller.get("area-to-update").update(value);
    }
    I created the files myself:
    I have saved my template for the dialog in 'app/views/dialogs/sqlsavename.html'.
    I have saved my SqlSaveName-assistant.jsjsjs $in$ '$app$/$assistants$/$SqlSaveName$-$assistant$.$js$'.

    That's what my sources.json looks like:

    Code:
    [
        {"source": "app/assistants/app-assistant.jsjsjs&$quot$;},
        {&$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$stage$-$assistant$.$js$&$quot$;},
        {
            &$quot$;$scenes$&$quot$;: &$quot$;$Stopwatch$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$Stopwatch$-$assistant$.$js$&$quot$;
        },
        {
            &$quot$;$scenes$&$quot$;: &$quot$;$SqlSaveName$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$SqlSaveName$-$assistant$.$js$&$quot$;
        },
        {
            &$quot$;$scenes$&$quot$;: &$quot$;$stored$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$stored$-$assistant$.$js$&$quot$;
        },
        {
            &$quot$;$scenes$&$quot$;: &$quot$;$StopwatchData$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$StopwatchData$-$assistant$.$js$&$quot$;
        },
        {
            &$quot$;$scenes$&$quot$;: &$quot$;$Timer$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$Timer$-$assistant$.$js$&$quot$;
        },
        {
            &$quot$;$scenes$&$quot$;: &$quot$;$TimerAlert$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$TimerAlert$-$assistant$.$js$&$quot$;
        }
    ]
    I just don't know what else can be the problem. For me everything looks fine !
  2. #2  
    SqlSaveName-assistant needs to be available in the stopwatch scene
  3.    #3  
    Quote Originally Posted by roar View Post
    SqlSaveName-assistant needs to be available in the stopwatch scene
    Sorry what exactly do you mean?
  4. #4  
    the SqlSaveName-assistant.jsjsjs $file$ $is$ $not$ $available$ $in$ $your$ $Stopwatch$ $scene$, $but$ $you$'$re$ $using$ $it$ $there$, $you$'$ll$ $have$ $to$ $fix$ $your$ $sources$.$json$
  5.    #5  
    Quote Originally Posted by roar View Post
    the SqlSaveName-assistant.jsjsjs $file$ $is$ $not$ $available$ $in$ $your$ $Stopwatch$ $scene$, $but$ $you$'$re$ $using$ $it$ $there$, $you$'$ll$ $have$ $to$ $fix$ $your$ $sources$.$json$
    Hehe okay...

    I tried this out of luck:

    Code:
    {
            "scenes": "Stopwatch",
            "source": "app/assistants/Stopwatch-assistant.jsjsjs&$quot$;
            {
            &$quot$;$scenes$&$quot$;: &$quot$;$SqlSaveName$&$quot$;,
            &$quot$;$source$&$quot$;: &$quot$;$app$/$assistants$/$SqlSaveName$-$assistant$.$js$&$quot$;
             }
        },
    Well this doesn't work. I must admit I never made a scene aviable for another. Can you give me a short example? Would be nice!!
  6. #6  
    Hm, do you even have a SqlSaveName scene? I thought it's a dialog.
    Anyway your code isn't valid json, try this:
    {
    "scenes": "Stopwatch",
    "source": "app/assistants/Stopwatch-assistant.jsjsjs&$quot$;
    },
    {
    "scenes": "Stopwatch",
    "source": "app/assistants/SqlSaveName-assistant.jsjsjs&$quot$;
    },
  7.    #7  
    Quote Originally Posted by roar View Post
    Hm, do you even have a SqlSaveName scene? I thought it's a dialog.
    Anyway your code isn't valid json, try this:
    {
    "scenes": "Stopwatch",
    "source": "app/assistants/Stopwatch-assistant.jsjsjs&$quot$;
    },
    {
    "scenes": "Stopwatch",
    "source": "app/assistants/SqlSaveName-assistant.jsjsjs&$quot$;
    },
    Yes it's a Dialog. Just copied the code from the palm example in the two files, SqlSaveName-assistant.jsjsjs $and$ $sqlsavename$.$html$.

    I'm working with eclipse. Perhaps it would be easier to make a Dialog from the scratch? I just don't get what they write on palm dev so I tried it with the example.

    Here is the SqlSaveName-assistant.jsjsjs $copied$ $from$ $the$ $example$ $and$ $hopefully$ $rewritten$ $without$ $errors$:

    Code:
    function SqlSaveNameAssistant(sceneAssistant,callbackFunc) {
    	this.callbackFunc = callbackFunc;
    	this.sceneAssistant = sceneAssistant;
    	this.controller = sceneAssistant.controller;
    }
    
    SqlSaveNameAssistant.prototype.setup = function(widget) {
    	this.widget = widget;
    	d = new Date();
    	this.t_attr = {
    		label:	'Time',
    		modelProperty:	'value',
    		minuteInterval : 10
    	    };
    	this.t_model = {
    		value : d
    	}
    	this.controller.setupWidget('time_field', this.t_attr, this.t_model);
    	this.save = this.save.bindAsEventListener(this);
    	this.cancel = this.cancel.bindAsEventListener(this);
    	
    	Mojo.Event.listen(this.controller.get('save'),Mojo.Event.tap,this.save);
    	Mojo.Event.listen(this.controller.get('cancel'),Mojo.Event.tap,this.cancel);
    	
    }
    function addZero(temp){
    	if(temp == 0)
    		return "00";
    	else
    		return temp;	
    }
    SqlSaveNameAssistant.prototype.save = function(event){
    	d = new Date(this.t_model.value);
    	if (d.getHours() > 12)
    		var t = addZero(d.getHours()) - 12 + ":" + addZero(d.getMinutes()) + " PM";
    	else if (d.getHours() == 12)
    		var t = addZero(d.getHours()) + ":" + addZero(d.getMinutes()) + " PM";
    	else
    		var t = addZero(d.getHours()) + ":" + addZero(d.getMinutes()) + " AM";
    		
    	this.callbackFunc(t);
    	this.widget.mojo.close();
    }
    SqlSaveNameAssistant.prototype.cancel = function(event) {	  
    	  this.widget.mojo.close();
    }
    SqlSaveNameAssistant.prototype.activate = function(event) {
    }
    
    SqlSaveNameAssistant.prototype.deactivate = function(event) {
    }
    
    SqlSaveNameAssistant.prototype.cleanup = function(event) {
    	Mojo.Event.stopListening(this.controller.get('save'),Mojo.Event.tap,this.save);
    	Mojo.Event.stopListening(this.controller.get('cancel'),Mojo.Event.tap,this.cancel);
    }
    Thanks for your help!

Posting Permissions