1 Prototyping for HCI Spring 2004 (Week 7) Jorge A. Toro.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Select Case Statements and Selection Input.
Advertisements

Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES.
Dialog Boxes and Menus. Menus Menu Bar Contains menus which drop down to display list of menu items Each item has a name and text property Each item has.
Microsoft Visual Basic: Reloaded Chapter Six Repeating Program Instructions.
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
Iteration (Looping Constructs in VB) Iteration: Groups of statements which are repeatedly executed until a certain test is satisfied Carrying out Iteration.
Using Multiple Forms. Creating a New Form ProjectAdd Windows Form.
1 Prototyping for HCI Spring 2004 (Week 8) Jorge A. Toro.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Printer & Dialog boxes Engr. Faisal ur Rehman CE-105T Spring 2007.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Visual C Sharp – File I/O - 1 Variables and arrays only temporary - lost when a program terminates Files used for long term storage (Data bases considered.
File Handling. Data Files Programs that can only get data from the user interface are limited. –data must be entered each time. –only small amounts of.
Microsoft Visual Basic 2008 CHAPTER NINE Using Arrays and File Handling.
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
Using Arrays and File Handling
5-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Typing Application Introducing Keyboard Events, Menus, Dialogs and the Dictionary.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
1 Working with Menus and Dialog Boxes. 2 Objectives You will be able to Create and edit menus for Windows Forms applications. Write code to handle menu.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Chapter 12: How Long Can This Go On?
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Chapter 9 - VB.Net by Schneider1 Chapter 9 – Additional Controls and Objects 9.1 List Boxes, Combo Boxes, and the File-Opening Control The List Box Control.
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Lecture Set 12 Sequential Files and Structures Part A – Dialog Boxes, Filters, Directories.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
Visual Basic Programming Chapter Six Notes Repetition and the Do Statement ADDING ICONS TO YOUR FORM –It is possible to add an ______________ to your title.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
Tutorial 6 The Repetition Structure
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Copyright © 2012 Pearson Education, Inc. Chapter 5 Loops, File, and Random Numbers.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Copyright © 2001 by Wiley. All rights reserved. Chapter 6: Using Arrays Control Arrays List Arrays Finding Items in Arrays Multiple Forms 2-Dimensional.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
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 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
PestPac Software. Leads The Leads Module allows you to track all of your pending sales for your company from the first contact to the close. By the end.
Chapter 8 P 1 Arrays and Grids Single-dimension arrays Definition An array is a sequence of elements all referred to with a common name. Other terms: table,
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
Chapter 5 Menus, Sub Procedures and Sub Functions Programming In Visual Basic.NET.
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code that may be executed several times. Fixed-count (definite) loops repeat a fixed.
Visual Basic.NET BASICS Lesson 11 List Boxes, For Next Loops, and Label Settings.
Controlling Program Flow with Looping Structures
Unit 6 Repetition Processing Instructor: Brent Presley.
Input Boxes, List Boxes, and Loops Chapter 5. 2 Input Boxes Method for getting user’s attention to obtain input. InputBox() for obtaining input MessageBox()
Iterations (aka Loops). 2 Loops Loops (iterations) are segments of code (loop body) that may be executed several times. Fixed-count (definite) loops repeat.
CSD 340 (Blum)1 Introducing Text Input elements and Ifs.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
Chapter 6 Controlling Program Flow with Looping Structures.
Arrays 1.
Using Multiple Forms.
How to Add Images Using an 'openFile' Dialog
CIS 16 Application Development Programming with Visual Basic
Additional Topics in VB.NET
Menus and Dialogs.
Prepared By: Deborah Becker
Looping and Multiple Forms TEST REVIEW
Guidelines for Microsoft® Office 2013
Introduction to Computer Programming IT-104
Presentation transcript:

1 Prototyping for HCI Spring 2004 (Week 7) Jorge A. Toro

2 The Language Repetitions

HCI430 – J.Toro3 Loops Do loop  Repeats a sequence of statements as long as the condition is true  Note: If the condition is false from the beginning, the statements are never executed Do While condition statement(s) Loop

HCI430 – J.Toro4 Loops While loop  Repeats a sequence of statements as long as the condition is true  Same as the prevouos Do Loop While condition statement(s) Wend

HCI430 – J.Toro5 Loops Do loop  This form of the Do loop executes the statements inside the loop before checking the condition.  Note: If the condition is false from the beginning, the statements are executed at least once. Do statement(s) Loop Until condition

HCI430 – J.Toro6 Loops For … Next loop Useful when we know how many times the loop should be executed. For counter = start To end statement(s) Next

HCI430 – J.Toro7 Loops For … Next loop This form of the loop increments the counter by 1 every time until it passes the end For counter = start To end statement(s) Next

HCI430 – J.Toro8 Loops For … Next loop This form of the loop increments the counter by s every time until it passes the end For counter = start To end Step s statement(s) Next

HCI430 – J.Toro9 Loops Breaking a loop  Sometimes you want to exit a loop before it reaches the end of the condition  Use Exit Do inside Do loops  Use Exit For inside For loops For counter = start To end Step s statement(s) If condition Then Exit For End if statement(s) Next If this condition is true, the loop is exited even if it hasn’t reached the end.

10 The Language Arrays

HCI430 – J.Toro11 Arrays Store multiple values of the same type under one name Dim arrayname(n) As type n = number of elements the array can hold

HCI430 – J.Toro12 Arrays Filling out Dim Arr(5) As integer Arr(0) = 1 Arr(1) = 23 Arr(2) = 37 Arr(3) = 8 Arr(4) = 2

HCI430 – J.Toro13 Arrays Filling out Dim Arr(3) As String Arr(0) = “each cell” Arr(1) = “holds” Arr(2) = “a different string”

HCI430 – J.Toro14 Arrays Practice: What does this code do? Dim Arr(5) As String For i=0 To 4 Arr(i) = InputBox(“Enter text”) Next

15 The Language Array Lists

HCI430 – J.Toro16 Array lists Array whose size is dynamically increased as required. They can store any kind of object.  Controls  Integers  Strings  …

HCI430 – J.Toro17 Array Lists Declaration Dim arrayname As New ArrayList() Note that the number of elements it can hold is not specified

HCI430 – J.Toro18 Array lists Adding an element to the array  Use the add method Dim lst As New ArrayList() lst.add(“Hello”) lst.add(1) lst.add(12.5) lst.add(True)

HCI430 – J.Toro19 Array lists What does this code do? Dim lst As New ArrayList() Dim obj As String obj = InputBox(“type in something”) lst.add(obj)

HCI430 – J.Toro20 Array lists Some properties/methods Count Item Insert Remove Add

HCI430 – J.Toro21 Array List Traversal Dim lst As New ArrayList() Dim elem as Type For Each elem In lst … Next This loop traverses the ArrayList by setting elem to each one of the objects in the array as it loops. This type must match the type of object in the array list

22 Controls ListView

HCI430 – J.Toro23 ListView Allows you to display a list of items with item text and, optionally, an icon to identify the type of item.

HCI430 – J.Toro24 ListView ViewGets or sets how items are displayed in the control. SmallImageListGets or sets the ImageList to use when displaying items as small icons in the control LargeImageListGets or sets the ImageList to use when displaying items as small icons in the control StateImageListGets or sets the ImageList associated with application-defined states in the control CheckedItems Gets the currently checked items in the control CheckBoxesGets or sets a value indicating whether a check box appears next to each item in the control

HCI430 – J.Toro25 ListView If an ImageList is specified in the StateImageList property and the CheckBoxes property is set to true, the images at index positions 0 and 1 in the ImageList are displayed instead of the check box. The image at index position 0 is displayed instead of the unchecked check box, and the image at index position 1 is displayed instead of the checked check box.

HCI430 – J.Toro26 ListView Example… displaying smileys ;)  Create an ImageList control  Populate the ImageList with the images of the smileys  Create an ImageView control  Set the ImageView’s SmallImageList property to the lmageList control  Set the ImageView’s View property to SmallIcon  Add items to the ListView. Fill out the Items propety. For each item, set the ImageIndex property to the corresponding image.

HCI430 – J.Toro27 ListView Filling out  If you want to display as SmallIcon, LargeIcon, or List Use lst.items.add(item) where lst is the name of the ListView Control and item is the information you want to show in the list.

HCI430 – J.Toro28 ListView Filling out  If you want to display as Details Here, the details view has columns. To add columns, use the Columns property.

HCI430 – J.Toro29

HCI430 – J.Toro30

HCI430 – J.Toro31

HCI430 – J.Toro32 ListView Filling out  Now with the columns in place, how do we fill them out? 1. Create a ListViewItem object The text property of this object will store the info for the first column Dim elem as New ListViewItem elem.text = “Hello, I go in the first column”

HCI430 – J.Toro33 ListView Filling out 2.To fill out the following colums, use the SubItems property of the ListViewItem object you created. Dim elem as New ListViewItem elem.text = “Hello, I go in the first column” elem.SubItems.Add(“I go in the second column”) elem.SubItems.Add(“I go in the third column”) elem.SubItems.Add(“I go in the fourth column”)

HCI430 – J.Toro34 ListView Filling out 3.After adding the sub items, add the ListViewItem object into the ListView control Dim elem as New ListViewItem elem.text = “Hello, I go in the first column” elem.SubItems.Add(“I go in the second column”) elem.SubItems.Add(“I go in the third column”) elem.SubItems.Add(“I go in the fourth column”) Lst.items.Add(elem)

35 Controls ProgressBar

HCI430 – J.Toro36 ProgressBar A ProgressBar control visually indicates the progress of a lengthy operation (copying something, transferring data, etc..). It displays a bar that fills in from left to right with the system highlight color as an operation progresses.

HCI430 – J.Toro37 ProgressBar ValueGets or sets the current position of the progress bar MaximumThis property specifies the upper limit of the Value property MinimumThis property specifies the lower limit of the Value property StepGets or sets the amount by which a call to the PerformStep method increases the current position of the progress bar PerformStepIncrements the value of the progress bar by the amount specified by the Step property IncrementEnables you to increment the value of the progress bar by a specific amount.

38 Controls Dialogs

HCI430 – J.Toro39 OpenFileDialog Represents a common dialog box that displays the control that allows the user to open a file.

HCI430 – J.Toro40 OpenFileDialog To use it  Drag an instance of the OpenFileDialog control over the form - OR -  Create the dialog in code Dim dlg As New OpenFileDialog()

HCI430 – J.Toro41 Drag an OpenFileDialog control over the form

HCI430 – J.Toro42 OpenFileDialog  The rest of the work is in the code Use the ShowDialog() method to display the dialog. This will return a value indicating what the user clicked (Ok or Cancel) Use the Filename property to get the filename selected by the user. Use the OpenFile() method to open the file and have it ready for access.

HCI430 – J.Toro43 OpenFileDialog Dim myStream As System.IO.Stream If OpenFileDialog1.ShowDialog() = DialogResult.OK Then myStream = OpenFileDialog1.OpenFile() If Not (myStream Is Nothing) Then ’Code for reading the file… myStream.Close() End If ’Sets the Text property of the form with the ’filename chosen by the user Me.Text = OpenFileDialog1.FileName End If

HCI430 – J.Toro44 OpenFileDialog InitialDirectory Gets or sets the initial directory displayed by the file dialog box. Filter Gets or sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box. FilterIndex Gets or sets the index of the filter currently selected in the file dialog box. Filename Gets or sets a string containing the file name selected in the file dialog box. OpenFile Opens the file selected by the user, with read-only permission. The file is specified by the FileName property.

HCI430 – J.Toro45 SaveFileDialog Represents a common dialog box that allows the user to specify options for saving a file.

HCI430 – J.Toro46 FontDialog Represents a common dialog box that displays a list of fonts that are currently installed on the system.

HCI430 – J.Toro47 FontDialog To use it  Drag an instance of the FontDialog control over the form - OR -  Create the dialog in code Dim dlg As New FontDialog()

HCI430 – J.Toro48 Drag an FontDialog control over the form

HCI430 – J.Toro49 FontDialog FontDialog1.ShowColor = True If FontDialog1.ShowDialog() <> DialogResult.Cancel Then ’Sets the new font and new foreground color for the textbox control TextBox1.Font = FontDialog1.Font TextBox1.ForeColor = FontDialog1.Color End If

HCI430 – J.Toro50 FontDialog FontGets or sets the selected font ColorGets or sets the selected font color ShowColorGets or sets a value indicating whether the dialog box displays the color choice ShowEffectsGets or sets a value indicating whether the dialog box contains controls that allow the user to specify strikethrough, underline, and text color options FixedPitchOnlyGets or sets a value indicating whether the dialog box allows only the selection of fixed-pitch fonts.

HCI430 – J.Toro51 Questions?