Top Banner
Fall 2002 CS/PSY 6750 1 User Interface Software Look under the hood Agenda Styles of tools Design tools UI toolkits GUI builder tools
26

Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools Design tools UI toolkits GUI builder tools.

Dec 14, 2015

Download

Documents

Josiah Foard
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 1

User Interface SoftwareLook under the hood

Agenda• Styles of tools

Design tools UI toolkits GUI builder tools

Page 2: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 2

Get What You Ask For

Page 3: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 3

User Interface Software

• What support is provided for building graphical user interfaces? UI toolkits GUI builder tools

• Let’s examine some background…

Page 4: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 4

GUI System Architecture Layered Architecture

Hardware

Higher level Tool

UI Toolkit

Window System

OS

Page 5: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 5

Window System

• Virtual display abstraction• Coordinates different input devices• Provides window primitives• Important components

Graphics model Input model

• May or may not include window manager

Page 6: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 6

UI Toolkit

• What application programmer typically programs with

• Combination of interface objects and management behaviors

• Usually object-oriented now• Library of software components and

routines that programmer puts together X Windows: X Toolkit & Motif Macintosh: Mac Toolbox, MacApp Windows: Windows Developers’ Toolkit Java: Swing

Page 7: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 7

Higher Level Tools

• Provide assistance or some automation in developing UIs

• Many names User Interface Management System

UIMS User Interface Builder User Interface Development

Environment

Page 8: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 8

Separation of Concerns

• Application Core functionality Operations Data

• Interface Interface

components Graphics I/O

Should these be separated in code? Why? Why not?

Page 9: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 9

How Does a Toolkit Work?

• What exactly does it provide?• How is it organized?

Toolkit Workings• User takes actions, interacts with interface• Those actions must be delivered to

application in meaningful ways• Application takes appropriate actions,

perhaps updating display

Page 10: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 10

Seeheim Model

Presentation Dialogcontrol

Applicationinterface

Dominant model for long time

Conversational model

Page 11: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 11

Object Model

• UI is collection of interactor objects (often called widgets)

• User directly manipulates them• Objects responsible for transmitting

user actions to application in meaningful ways

UI Application

User

Page 12: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 12

Locus of Control

• “Traditional” software Control is in system, query user when

input needed

• Event-driven software Control is with user (wait for action) Code reacts to user actions More difficult to write code this way,

harder to modularize, etc.

Page 13: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 13

Event-Driven Program

• Initialize display & system• Repeat

Wait for and get next user action Decipher action Take appropriate action Update display

• Until Done

Page 14: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 14

Event-Driven Program

Mainapplication

code

EntrypointSystem

What’s that?

UI

Page 15: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 15

Callback Routine

• Software procedure, part of application

• Invoked when particular action occurs to UI component, such as pressing a PushButton

• Procedure is invoked with event parameters

Page 16: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 16

Example – X & Motif

• Object-oriented hierarchy of UI interactors called widgets Associate callback routines in your code

with them

• Interface is built up by putting child widgets “onto” parent widgets

Page 17: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 17

WidgetGraphical user interface interactor object

Page 18: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 18

Widget Hierarchy

• Widgets organized into inheritance hierarchy

Primitive

ButtonLabel Scroll BarText

Push Button Toggle ButtonDrawn Button

Page 19: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 19

Widget

• Visual appearance• Set of tailorable attributes

• Interactive behavior

PushButton { Color BackGround; int MarginLeft; int MarginRight; int BorderWidth; Pixmap ArmPixmap; Boolean FillOnArm; CallbackList ActivateCallback;}

Page 20: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 20

Widget Use

• Set up widget attributes• Create widget object (as child of

parent widget)• Define callback or event procedure

for widget

Page 21: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 21

Widget and Callback

n = 0; xmstr = XmStringCreate("Color",XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, xmstr); n++; XtSetArg(args[n], XmNbackground, red); n++;colorbut = XtCreateManagedWidget("colorbutton", xmPushButtonWidgetClass,focusrowcol, args, n); XtAddCallback(colorbut, XmNactivateCallback, colorChangeCB, id);

voidcolorChangeCB(Widget w, XtPointer userdata, XtPointer evtdata){ // Actions}

Page 22: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 22

Main Program Event Loop

voidCheckXEvents(){ XEvent xev;

while (XtAppPending(_context)) { XtAppNextEvent(_context, &xev); XtDispatchEvent(&xev); }}

Page 23: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 23

OO Systems

• Java’s GUI programming done with AWT and Swing

• More distributed model (separate threads)

• Primary action here is dispatching events to objects (widgets) as messages

• Delegation important Can make particular objects responsible for

event handling

Page 24: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 24

GUI Builder Tools

• Why build graphical (visual) interface with textual commands?

• Why not show what you want it to look like?

• Visual builder tools: Visual Basic, Visual C++, Borland Delphi, Symantec Cafe

Page 25: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 25

Tool Methods

• Work area (interface being built)• Drag and drop interactors/widgets

onto work area• Specify position, color, look, etc.• Often provide Build/Test modes

Page 26: Fall 2002CS/PSY 67501 User Interface Software Look under the hood Agenda Styles of tools  Design tools  UI toolkits  GUI builder tools.

Fall 2002 CS/PSY 6750 26

Example: dtbuilder (Motif)