HelloAssistant.prototype.setup = function() {
// set the initial total and display it
this.total=0;
this.controller.get('count').update(this.total);
// a local object for button attributes
this.buttonAttributes = {};
// a local object for button model
this.buttonModel = {
buttonLabel : 'TAP HERE',
buttonClass : '',
disabled : false
};
// set up the button
this.controller.setupWidget("MyButton", this.buttonAttributes, this.buttonModel);
// bind the button to its handler
Mojo.Event.listen(this.controller.get('MyButton'), Mojo.Event.tap, this.handleButtonPress.bind(this));
}
HelloAssistant.prototype.handleButtonPress = function(event){
// increment the total and update the display
this.total++;
this.controller.get('count').update(this.total);
}
this.controller.pushScene('first');
Here are the commands for the presentation:
palm-generate -p "{title:'Hello Atlanta', id:org.predevcamp.atlanta.hello, version:'1.0.0'}" HelloAtlanta
palm-package HelloAtlanta
palm-install org.predevcamp.atlanta.hello_1.0.0_all.ipk
palm-generate -t new_scene -p "name:Hello" HelloAtlanta
Here are the code snippits for the presentation:
Code Snippit 1 (hello-scene.html)
Code Snippit 2 (stage-assistant.js)
Code Snippit 3 (hello-assistant.js)
Code Snippit 4 (hello-assistant.js)
<div id="main">
<div>Header</div>
<div id="count">0</div>
<div id="MyButton" name="MyButton1" x-mojo-element="Button"></div>
</div>