Programming Lists of Data 靜宜大學資管系 楊子青

Slides:



Advertisements
Similar presentations
Understanding an Apps Architecture ASFA Computer Science: Principles Fall 2013.
Advertisements

JustinMind: Dynamic Panels
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
CSCI 6962: Server-side Design and Programming Input Validation and Error Handling.
靜宜大學資管系 楊子青 1 Programming Your App’s Memory 靜宜大學資管系 楊子青
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
No Texting While Driving. Introduction You'll design the app so that it sends a response to any text message received. You'll also allow the user to customize.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Introduction To Form Builder
Introduction to AppInventor Dr. José M. Reyes Álamo.
Programing App Inventor. Variable Declaration App Inventor: Declare Variables using the “Define Variable As” Block – Find the Blocks Editor (top-left),
CST JavaScript Validating Form Data with JavaScript.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Creating Mobile Apps with App Inventor! Day 5 Google search Kris Gordon Ludlow for links.
CS 104 October 26, 2011 App Inventor. Agenda Discuss guest speakers Discuss quiz Finish Paint Pot Discuss concepts from Chapters 2 & 3 Mole Mash (if time.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Visual Basic Games: Prepare for Hangman
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Quiz Me Tutorial. Introduction QuizMe is a trivia game (the example uses baseball) you can use as a template to build quizzes on any topic. The user steps.
Quiz Me Extensions. Increasing Flexibility of Answer Evaluation Currently in Quiz Me, if the users doesn’t type enter the exact answer from your “AnswerList”,
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
Flag Quiz Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Scratch Programming Cards
Section 10.1 Define scripting
JavaScript, Sixth Edition
Chapter 5 Validating Form Data with JavaScript
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Computing with C# and the .NET Framework
Introduction to Event-Driven Programming
Chapter 8: Writing Graphical User Interfaces
Visual Programming week # 02 APP (Application) Architecture.
CS Data Structures Chapter 8 Lists Mehmet H Gunes
3.01 Apply Controls Associated With Visual Studio Form
Section 17.1 Section 17.2 Add an audio file using HTML
Understanding an App’s Architecture
Visual programming Chapter 1: Introduction
3.01 Apply Controls Associated With Visual Studio Form
Section 10.1 YOU WILL LEARN TO… Define scripting
Using Procedures and Exception Handling
Lesson 1: Buttons and Events – 12/18
Chap 7. Building Java Graphical User Interfaces
Chapter 16 – Programming your App’s Memory
Graphical User Interfaces -- Introduction
Variables and Arithmetic Operations
VISUAL BASIC.
Understanding an App’s Architecture
Memory Matching Challenge
LESSON 14 - Building an App: Image Scroller
CIS16 Application Development and Programming using Visual Basic.net
CIS 16 Application Development Programming with Visual Basic
Database Applications
Fonts, TabControl, ListBox
Web Development Using ASP .NET
Introduction to AppInventor
Training & Development
Tonga Institute of Higher Education
Approvals Mobile User Interface WORK BETTER.
The University of Texas – Pan American
Visual Programming week # 05 Lists Quiz Tutorial.
Creating Additional Input Items
CHAPTER FOUR VARIABLES AND CONSTANTS
Presentation transcript:

Programming Lists of Data 靜宜大學資管系 楊子青 2013.3.11.

Complex, interrelated items that must be organized Many apps process lists of data. For example: Facebook processes your list of friends. A quiz app works with a list of questions and answers. A game might have a list of characters or all-time high scores. In this chapter, we’ll examine the way App Inventor handles data. static lists (in which the data doesn’t change) dynamic lists (in which the data is user-generated).

A list variable represents a set of memory cells The elements of a list are accessed using an index. An index is a position in a list, so: index 1 of the list refers to 111–2222, index 2 refers to 333–4444, and index 3 refers to 555–6666

1. Static lists The elements are defined by the programmer (you) and whose items don’t change unless you change the blocks themselves.

1.1 Creating a List Variable From the Built-In Palette, drag a def variable block into the program area. Click the text “variable” and change the name to “phoneNumbers”. From the Lists palette, drag out a make a list block and plug it into the definition block.

Creating a List Variable (Cont.) (4) Finally, drag in some text blocks, enter the desired phone numbers, and plug them into the “item” slots in the make a list block.

1.2 Selecting an Item in a List Your app can access particular items of a list with the select list item block and by specifying an index in the list. The result would be “333–4444”.

1.3 Using an Index to Traverse a List In many apps, you’ll define a list of data and then allow the user to step through (or traverse) it.

List index too large The error message displayed when the app tries to select the fourth item from a three-item list.

Reset index Using the if test to check for whether the index value is larger than the length of the list, and reset it to 1 if the test returns true

2. Dynamic Lists Lists that change based on the end user entering new items, or new items being loaded in from a database or web information source.

2.1 Defining a Dynamic List Just as with a static list, you define a dynamic list with the make a list block. But with a dynamic list, you don’t add any predefined items in the list definition.

2.2 Adding an Item Using a form to add new items to the notes list. The add item to list block appends the item to the end of the list. You’ll find the add item to list block in the List drawer.

2.3 Removing an Item from a List You can remove an item from a list with the remove list item block.

2.4 Displaying a List The simplest way to display a list in your app’s user interface: to use the same method you use for displaying numbers and text: put the list in the Text property of a Label component.

The defult list display is not very elegant (優雅)

2.5 ListPicker component is a user interface component displays the items of a list and allows the user to choose one. can be used for removing items.

Key events of the ListPicker component and their properties (1/2) The ListPicker.BeforePicking event is triggered when the user clicks the ListPicker’s associated button but before the choices are listed. You can set the ListPicker.Elements property to a list variable.

Key events of the ListPicker component and their properties (2/2) The ListPicker.AfterPicking event When the user chooses an item in the list, the event is triggered. you can access the user’s selection in the ListPicker.Selection Property.

2.6 Remove item from list by ListPicker 利用ListPicker.SelectionIndex找出要刪除的元素所在位置 使用remove list item: 填入List變數 Index為ListPicker.SelectionIndex

練習:資管系實驗室列表App 讓使用者利用Textbox輸入資管系實驗室,逐一將以下資料加入List變數,於ListPicker顯示結果 主顧403 電子商務實驗室 (403EC) 主顧405 企業資源規劃實驗室 (405ERP) 主顧407 醫療資訊系統實驗室 (407HIS) 主顧409 資料庫與資料探勘實驗室 (409DB) 主顧411 資訊安全與網路管理實驗室 (411NM) 主顧413 多媒體技術與應用實驗室 (413MM) 主顧415 智慧代理人與行動商務實驗室 (415IA) 使用者如果在ListPicker選了一個實驗室,則將該實驗室資料刪除

執行實例