Contenu connexe
Similaire à Einführung in die webOS Programmierung (20)
Einführung in die webOS Programmierung
- 54. Beispiel (Javascript) var attributes= { modelProperty: 'original', focusMode: Mojo.Widget.focusSelectMode, maxLength: 30 }; this.model = { original: 'Bitte etwas eingeben', disabled: false };
- 81. index.html <!DOCTYPE html> <html> <head> <title>Hello World</title> <script src = "/usr/palm/frameworks/mojo/ mojo.js " x-mojo-version="1"></script> <link href="/stylesheets/helloworld.css" media="screen" rel="stylesheet" type="text/css"> </head> </html>
- 83. Szenen hinzufügen palm-generate -t new_scene -p "name=first" helloWorld palm-generate -t new_scene -p "name=second" helloWorld app/views/first/first-scene.html app/assistants/first-assistant.js
- 84. Szenen-HTML <div id="main" class="palm-hasheader"> <div class="palm-header">First Scene</div> <div class="palm-text">Welcome to my World</div> <div x-mojo-element="Button" id="button1"></div> </div>
- 85. Javascript - Setup stage-assistant.js: Mojo.Controller.stageController.pushScene("first"); first-assistant.js: this.controller.setupWidget("button1", this.attributes = {}, this.model = { label : "OK", disabled: false } );
- 86. Javascript - Handler this.handleButton1=this.handleButtonPress1.bindAsEventListener(this); Mojo.Event.listen(this.controller.get("button1"), Mojo.Event.tap, this.handleButton1); FirstAssistant.prototype.handleButtonPress1 = function(event){ Mojo.Controller.stageController.pushScene("second"); }