13
apps the latest version of this document at http://touchdevelop.com/slid

Apps Find the latest version of this document at

Embed Size (px)

DESCRIPTION

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”)

Citation preview

Page 1: Apps Find the latest version of this document at

apps

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

Page 2: Apps Find the latest version of this document at

learning objectiveso writing apps!

o Wall, Tap events and Pageso Recordso Geo-locationo Searcho Web APIs and web requests

• RSS, JSON, XML

Page 3: Apps Find the latest version of this document at

wallo The wall represents the screeno New item on top “a la facebook”

set reversed (true) - to reverse ordero Clear the wall

wall->clearo Background color and picture wall->set background(colors->random)

o Title and subtitle wall->set title(“Title of my change”)

Page 4: Apps Find the latest version of this document at

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

Page 5: Apps Find the latest version of this document at

inputo 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/vxez

o user may pick a time, datevar date := all→pick date(“Enter your birthdate”)☁ http://touchdevelop.com/ryor

Page 6: Apps Find the latest version of this document at

textboxo 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 ...

Page 7: Apps Find the latest version of this document at

page stacko 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 wallo The user can pop a page by pressing

the back button

Page 8: Apps Find the latest version of this document at

recordso 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

Page 9: Apps Find the latest version of this document at

record car model : string year : number

o tablevar r := car table->create rowr->model->set(“beetle”)var year := r->year->get

o index (model is key)var r := car table->at(“beetle”)r->year->set(“beetle”)

o objectvar r := car table->creater->model->set(“beetle”)r->year->set(1970)var rs := car table->create collectionrs->add(r)

1 table per script

Keys are immutable

Collection is like a list

Page 10: Apps Find the latest version of this document at

geo-locationRetrieve 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 maploc->post to wall

Page 11: Apps Find the latest version of this document at

invalid valueso 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

Page 12: Apps Find the latest version of this document at

searcho Built-in Bing searchweb->searchweb->search imageso Built-in Twitter/Facebook searchsocial->search

Page 13: Apps Find the latest version of this document at

web requestso “if you need something, there is probably

a Web API that does it”o Full support for HTTP requests// setup requestvar request := web->create request(url)// send request, receive responsevar response := request->send// read responseresponse->content->post to wall