Lecture 2: Events + Service Routines + Instance vs local Variable CSS290: APPS ON MOBILE DEVICES.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Advertisements

11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Lecture 1: IDE + Application Structure + GUI Elements CSS290: APPS ON MOBILE DEVICES.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
DT265-2 Object Oriented Software Development 2 Lecture 3 : Windows Programming Lecturer Pat Browne
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
1 COS240 O-O Languages AUBG, COS dept Lecture 33 Building Apps Technologies C# (WPF part 1)
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Introduction to Mobile Programming. Slide 2 Overview Fundamentally, it all works the same way You get the SDK for the device (Droid, Windows, Apple) You.
Advanced Level Course. Site Extras Site Extras consist of four categories: Stationeries Site Trash Designs Components.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
IE 411/511: Visual Programming for Industrial Applications
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Chapter 1: An Introduction to Visual Basic 2005 Programming with Microsoft Visual Basic 2005, Third Edition.
Rudi Grobler Session Code: WUX205.
Introduction to Matlab & Data Analysis
Intro to MFC. Open VS and create new project 1)Open MS Visual Studio 2008 Professional (It must be the Professional Edition, the Express Edition will.
Using the Netbeans GUI Builder. The Netbeans IDE provides a utility called the GUI Builder that assists you with creating Windows applications. The Netbeans.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
Chapter 3: Using GUI Objects and the Visual Studio IDE.
SE 320 – Introduction to Game Development Lecture 8: Animations, GUIs, Debugging and IDEs Lecturer: Gazihan Alankuş Please look at the last two slides.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Enhancing the Graphical User Interface Multiple Forms, Controls, and Menus.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
IOS with Swift Hello world app.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Designer Basics.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
TODAY: CONCEPTS Development for portable devices Definition of resources Deployment of resources Begin GUI Elements Properties and organization Events.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
CS324e - Elements of Graphics and Visualization Java GUIs - Event Handling.
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Graphical Enablement In this presentation… –What is graphical enablement? –Introduction to newlook dialogs and tools used to graphical enable System i.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 41 JavaServer Face.
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
Lecture 3: Application State + Event Driven Programming CSS290: APPS ON MOBILE DEVICES.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
 You won’t write a single line of program code.  Instead, you’ll use visual programming techniques.  Visual Studio processes your actions (such as mouse.
Dive Into® Visual Basic 2010 Express
Java FX: Scene Builder.
Working in the Forms Developer Environment
Microsoft Visual Basic 2005 BASICS
1. Introduction to Visual Basic
WPF AKEEL AHMED.
Hands-on Introduction to Visual Basic .NET
Tutorial 6 Creating Dynamic Pages
Building an Application in the Visual Basic .NET Environment
Using Templates and Library Items
Visual C# - GUI and controls - 1
Chapter 4 Enhancing the Graphical User Interface
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

Lecture 2: Events + Service Routines + Instance vs local Variable CSS290: APPS ON MOBILE DEVICES

TODAY: CONCEPTS Reading: Chapter 2 (skip discussion on XNA) User Event Driven Application Structure Protocols of function calls Event driven model UI elements Definition, appearance, how to modify UI element hierarchy Event propagation model Naming and changing the state of an UI element For fun: The Timer utility, TimeSpan, and a stopwatch.

GUI ELEMENTS Elements of Graphical User Interface: A Textbox, a Button, a Sliderbar, etc A Window, a “Panel” Open in Expression Blend Relationships: Expression Blend vs. Properties Window Try: Save in one window and see in the other Notice how.xaml file content changes! Two programs shares data via a file! Don’t change in both at the same time!!

EXPRESSION BLEND Cool? Easy way of edit the appearance of GUI elements Text color, font size, location of textbox … Windows  Tools, Assets, Properties, Objects and Timeline, Device Tools and Assets: overlaps! Properties: lets you control the appearance Important insight!!

GUI ELEMENT HIERARCHY The Default Hierarchy of the GUI element! LayoutRoot parent of: TitlePanel and ContentPanel TitlePanel and ContentPanel: are siblings Children of LayoutRoot ApplicationTitle and PageTitle: siblings Children of ContentPanel Why is this important? Try deleting LayoutRoot?! Or moving it! Important to know parents of a GUI element!!

CHAPTER 2: EVENTS Reading: Chapter 2 to Page 37. Objectives: GUI Elements as variables GUI Element Alignment problem Window Size change (e.g., Phone orientation change) Event Driven Programming Structure Event propagation model Notice: same event in entire ancestry tree Service Events Event service routines

LET’S TRY: Add in a TextBox Change alignment Change alignment with offset Change color Add a rectangle How to “group” the rectangle and TextBox under the same alignment? Hint: Canvas How to move existing elements into a canvas? WATCH OUT: Properties window: the Event vs. Properties Tab!!

EXPRESSION BLEND Add in a new textbox Give this textbox a name: A NAME? GUI element hierarchy The object that contains the variable name: Which one? Exercise: Create a canvas move the textbox into the canvas … Notice, the textbox has a new GUI parent The textbox’s variable belongs to MainPage Learn: cannot name two GUI elements the same name! MainPage.xaml.cs: MainPage() Set the Text content on the textbox ALL properties of all GUI elements can be changed in the.cs file!!

SWITCH ON ORIENTATION SUPPORT Expression Blend Notice which GUI element you select!! Only one (the very root) has Orientation property See the exact same property can be access via Visual Studio (IDE) Remember, same data!! Find the file being changed! Which one? Now, run, the MainPage reacts “intuitively” Nice? No? What’s happening to your textBox, what do you want from it?

TEXT (OR: ANY GUI) PLACEMENT This is a real problem in general! GUI Window size change!! Look at your WORD document, when you resize your window what happens? Choice: Policy!! Statically defined: does not change during runtime Specify measured from which boundary, how many pixels Program control: Policy At run time, move GUI according to some policy E.g., distance from the Top/Left How does WORD support its menus?

ALIGNING TEXT OR ANYTHING! Align Text wrt Top/Left (TL) Align Rectangle wrt Bottom Left How to align two GUI elements at the same time? Canvas! Silverlight datatypes to work with: Orientation: enumerated datatype Panel/Layout: ActualWidth/Height RenderSize

EVENTS AND EVENT SERVICES Select Content Panel Properties Tab: look at all the events!! Let’s look at size change Add in a “Service Function: !! BAM!! Just Registered a event service function with the ContentPanel What? This function will be called when ContentPanel size changes Who is calling this function? WPF What do we do in this function? One thing! One thing and return! Let’s see what is the size, and size change

EVENTS AND SERVICE ROUTINES Events are generated by user action Events are “sent” to a GUI element Root window, Panel, textbox, etc. etc. We can choose to let a GUI “service” an event Find the GUI Find the event Define the service routine! Same event service tag can exists all along the UI element parentage hierarchy Now, what should we do to receive orientation change?

EXAMPLE: TIMER Start a “System Timer” Variable types: Instances vs. Local  the difference?! The StopWatchTimer app: DispatcherTimer (Systems.Windows.Threading) Interval, Tick, and Start() Date and time: DateTime, TimeSpan Rectangle UI element SolidColorBrush

MP2: STOP WATCH TIMER HINTS Two states in the application TimerRuning: Timer.tick must compute elapsed time Fill with Greenish color Status help message New CurrentTime Clear all timer label strings Label.Text = “”; Timer Stopped: Timer.Tick does not do anything Fill with Redish color Status help message

SELF TEST Where is the main() function in an event driven programming model? What are UI elements? When we say “UI elements are grouped hierarchically what do we mean”? Alternatively, we say, my text-label is the child of root window, what do I mean? What is the implication of this hierarchy on user event propagation? Why do we care about UI layout policy in Graphical User Interface programs? E.g., like WORD? What is the best way to control UI element layouts? How often does DispatcherTimer timer event trigger? What happens when the timer event triggers?

APPENDIX: MISC INFO.xaml.cs vs..cs Properties Window Properties vs. Event tabs Debugging, stop and examine results Editing/running from Expression Blend Event call backs Which GUI element is generating the event