CSCE 121:509-512 Introduction to Program Design and Concepts, Honors Dr. J. Michael Moore Spring 2015 Set 15: GUIs 1.

Slides:



Advertisements
Similar presentations
Chapter 16 Graphical User Interfaces
Advertisements

Microsoft® Small Basic
Chapters 12 and 13 A Display Model and Graphics Classes John Keyser’s Modifications of Slides by Bjarne Stroustrup
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
AA high level programming language. IIt is created by Microsoft. UUses a graphical environment called the Integrated Development Environment (IDE).
Microsoft® Small Basic
What’s the computer?? computer is an electronic device that stores, processes, inputs, and outputs data to produce a result.
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.
Chapter 1- Visual Basic Schneider 1 Chapter 1 An Introduction to Computers and Visual Basic.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Chapter 7 Improving the User Interface
MCT260-Operating Systems I Operating Systems I Interfaces to Operating Systems.
Graphical User Interfaces A Quick Outlook. Interface Many methods to create and “interface” with the user 2 most common interface methods: – Console –
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Not in Text CP212 Winter No VBA Required “Regular” Programming traditional programming is sequential in nature o one command executed after another.
Chapter 3 Working with Symbols and Interactivity.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Microsoft PowerPoint Getting Started Guide Prepared for Towson University Dr. Jeff M. Kenton Amy Chase Martin 2007.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Welcome to Keyboarding Pro DELUXE ® Get Started Get Started Create Your Student Record Create Your Student Record The Main Menu The Main Menu Send Files.
Introduction to Matlab & Data Analysis
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Visual Basic 2005 CHAPTER 2 Program and Graphical User Interface Design.
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
1 Input and Interaction. 2 Input Devices Physical input devices Keyboard devices and pointing devices Logical input devices.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
CSCE 121: Introduction to Program Design and Concepts Dr. J. Michael Moore Spring 2015 Set 12: A Display Model 1 Based on slides created by Bjarne.
CS350 – Windows Programming Formerly and more properly named: Event Driven Programming Dr. Randy Ribler.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Python Programming Graphical User Interfaces Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Computing Science 1P Lecture 17: Friday 23 rd February Simon Gay Department of Computing Science University of Glasgow 2006/07.
Chapter 2 – Introduction to the Visual Studio .NET IDE
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Lesson No: 6 Introduction to Windows XP CHBT-01 Basic Micro process & Computer Operation.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
CSCE 121: Introduction to Program Design and Concepts Dr. J. Michael Moore Spring 2015 Set 4: Computation 1 Based on slides created by Bjarne Stroustrup.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
GUIs Basic Concepts. GUI GUI : Graphical User Interface Window/Frame : a window on the screen Controls/Widgets : GUI components.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Creating User Interfaces Event-Driven Programming.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
Introduction to Programming
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Introduction to Programming
Dive Into® Visual Basic 2010 Express
Topics Graphical User Interfaces Using the tkinter Module
Introduction to Programming
An Introduction to Computers and Visual Basic
Lesson 1: Buttons and Events – 12/18
Fundamentals of Python: From First Programs Through Data Structures
Event Driven Programming
GRAPHICAL USER INTERFACE
An Introduction to Computers and Visual Basic
Chapter 16 Graphical User Interfaces
Topics Graphical User Interfaces Using the tkinter Module
Event Driven Programming Anatomy – Handle
Chapter 16 Graphical User Interfaces
Graphics and FLTK CSCE 121 J. Michael Moore
Chapter 16 Graphical User Interfaces
Presentation transcript:

CSCE 121: Introduction to Program Design and Concepts, Honors Dr. J. Michael Moore Spring 2015 Set 15: GUIs 1

CSCE 121: Set 15: Plotting Functions and Data I/O Alternatives Console (screen and keyboard) – Strong contender for technical/professional work – Command-line interface – Menu-driven interface Graphical User Interface (GUI) – Use a GUI library – Matches “feel” of Windows and Mac applications – Event-driven program design 2

CSCE 121: Set 15: Plotting Functions and Data Common GUI Tasks Titles / text – Labels – User instructions and prompts Fields / dialog boxes – Input – Output Buttons – Let the user initiate actions – Let the user select among a set of alternatives 3

CSCE 121: Set 15: Plotting Functions and Data More Common GUI Tasks Display results – Shapes – Text and numbers More advanced (we won’t do this) – Tracking the mouse – Dragging and dropping – Free-hand drawing 4

CSCE 121: Set 15: Plotting Functions and Data GUI Programming Techniques 1.Object-oriented programming – Organize program parts with common interfaces and common actions 2.Event-driven programming – Connect an event (e.g., a mouse click) with a program action (some code) 5

CSCE 121: Set 15: Plotting Functions and Data Layers of Software 6 Our program Our GUI/Graphics interface library FLTK The operating system Graphics GUI facilities Device driver layer Example of a layer Provides services Uses services

CSCE 121: Set 15: Plotting Functions and Data Demo GUI program to draw a series of lines with – 2 buttons (next point and quit) – 2 input boxes (for entering x and y coordinates) – 1 output box (for displaying more recent point) – 1 menu (for choosing line color from 3 choices) User enters x and y coordinates of next point, then hits “next point” button, and program adds this point to the Open_polyline and redraws the shape User can also use menu to change line color at any time Continue until user hits quit button 7

CSCE 121: Set 15: Plotting Functions and Data Questions We saw buttons, input and output boxes, and menu in the window – How do we define them? We clicked on a button and something happened – How do we program that action? – How do we connect that code to the button? We typed something into an input box – How do we get that value into our code? – How do we convert from string to number? We saw output in the output box – How did it get there? Lines appeared in the window – How do we store the lines? – How do we draw them? 8

CSCE 121: Set 15: Plotting Functions and Data Answers We’ll see how to accomplish these tasks using Stroustrup’s interface files and FLTK. 9

CSCE 121: Set 15: Plotting Functions and Data Widgets, Buttons, and Callbacks A Widget is something you see in the window which has an action associated with it A Button is a Widget that displays as a labeled rectangle on the screen, and when you click on the button, a Callback is triggered A Callback connects the button to some function or functions (the action to be performed) 10

CSCE 121: Set 15: Plotting Functions and Data How it Works 11 Our code Window FLTK Attach Button Describe where the button is Describe what the button looks like Register Button’s callback Call “callback” when Button is pressed

CSCE 121: Set 15: Plotting Functions and Data Callback Callbacks connect our code to the lower-level system Connecting functions to widgets is frequently messy in GUIs The lower-level system does not know about the higher-level C++ constructs – Need to bridge this gap For now, view this as just (ugly) boilerplate 12

CSCE 121: Set 15: Plotting Functions and Data Control Inversion Where is the program? It consists of – Setting up the appearance of the window – Responding to the user clicking on widgets int main() { My_window win(/* … */); return gui_main(); // infinite loop in FLTK } 13

CSCE 121: Set 15: Plotting Functions and Data Control Inversion Traditional program: GUI (note how control is “inverted”) 14 Application Input function User responds call prompt User “action” System Application click callback

CSCE 121: Set 15: Plotting Functions and Data Code Walk-Through See sample-gui.cpp 15

CSCE 121: Set 15: Plotting Functions and Data Acknowledgments Slides are based on those for the textbook: 16