Presentation is loading. Please wait.

Presentation is loading. Please wait.

Apps Find the latest version of this document at

Similar presentations


Presentation on theme: "Apps Find the latest version of this document at"— Presentation transcript:

1 apps Find the latest version of this document at http://touchdevelop.com/slides.http://touchdevelop.com/slides

2 learning objectives o writing apps! o Wall, Tap events and Pages o Records o Geo-location o Search o Web APIs and web requests RSS, JSON, XML

3 wall o The wall represents the screen o New item on top “a la facebook” set reversed (true) - to reverse order o Clear the wall wall->clear o Background color and picture wall->set background(colors->random) o Title and subtitle wall->set title(“Title of my change”)

4 Wall – input, output o Ask the user number var x := wall -> ask number (“Enter the number”) o Display the content (“ current sum up to “ || n || “is” || sum) -> post to wall

5 input o user may be asked for text, Boolean, numbers var name := all→ask string(“Enter your name”) var age := all→ask number(“Enter your age”) var ok := all→ask boolean(“Are you ok?”) ☁ http://touchdevelop.com/vxezhttp://touchdevelop.com/vxez o user may pick a time, date var date := all→pick date(“Enter your birthdate”) ☁ http://touchdevelop.com/ryorhttp://touchdevelop.com/ryor

6 textbox o A skin-able textbox var tb := wall->create text box(“Run”, 19) o Change color, font size, etc… o Attach tap event event tap wall TextBox(item : TextBox) if item->text->equals(“Run”) then...

7 page stack o A page contains a “wall” o Pages can be stacked wall->push new page, adds a new blank wall wall->pop page, removes the top wall o The user can pop a page by pressing the back button

8 records o structured data Table: Similar to your Excel table. Index: table with index lookup Object: garbage collected objects (and collections) Decorator: add fields to existing objects

9 record car model : string year : number o table var r := car table->create row r->model->set(“beetle”) var year := r->year->get o index (model is key) var r := car table->at(“beetle”) r->year->set(“beetle”) o object var r := car table->create r->model->set(“beetle”) r->year->set(1970) var rs := car table->create collection rs->add(r) 1 table per script Keys are immutable Collection is like a list

10 geo-location Retrieve the longitude and latitude of the phone. o var loc := senses->current location Low precision 1 mile. Might use WiFi or Cell tower o var loc := senses->current location accurate Better precision, tries to force GPS. o Easy way to show a map loc->post to wall

11 invalid values o What if the user refuses to give his location? var loc := senses->current location o The value loc is invalid. if loc->is invalid then // do something without location

12 search o Built-in Bing search web->search web->search images o Built-in Twitter/Facebook search social->search

13 web requests o “if you need something, there is probably a Web API that does it” o Full support for HTTP requests // setup request var request := web->create request(url) // send request, receive response var response := request->send // read response response->content->post to wall


Download ppt "Apps Find the latest version of this document at"

Similar presentations


Ads by Google