9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley

Slides:



Advertisements
Similar presentations
1 Graphical User Interface (GUI) Applications Abstract Windowing Toolkit (AWT) Events Handling Applets.
Advertisements

Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
MSc. Publishing on WWW JavaScript. What is JavaScript? A scripting language devised by Netscape Adds functionality to web pages by: Embedding code into.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Tcl and Tk CSE 470 Fall 1999 Revised by Prasad. Objective To use Tcl Tk to develop GUI and prototype of the project.
Guide To UNIX Using Linux Third Edition
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
Chapter 6: Graphical User Interface (GUI) and Object-Oriented Design (OOD) J ava P rogramming: Program Design Including Data Structures Program Design.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
Chapter 1 Introduction to Visual Basic Programming and Applications 1 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta.
1 Programming Concepts Module Code : CMV6107 Class Contact Hours: 45 hours (Lecture 15 hours) (Laboratory/Tutorial 30 hours) Module Value: 1 Textbook:
Java Programming Chapter 10 Graphical User Interfaces.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
M1G Introduction to Programming 2 4. Enhancing a class:Room.
Microsoft Visual Basic 2005: Reloaded Second Edition
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Introduction to NS2 -Network Simulator- -Prepared by Changyong Jung.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
An Introduction to Visual Basic
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Computer Science 111 Fundamentals of Programming I Overview of Programming.
Tcl/Tk package in R Yichen Qin
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
Chapter 17: Applets, Images, and Sound. Objectives Learn about applets Write an HTML document to host an applet Use the init() method Work with JApplet.
BLU-ICE and the Distributed Control System Constraints for Software Development Strategies Timothy M. McPhillips Stanford Synchrotron Radiation Laboratory.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
Oracle Data Integrator Procedures, Advanced Workflows.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
CNS 1410 Graphical User Interfaces. Obectives Students should understand the difference between a procedural program and an Event Driven Program. Students.
Getting started with Programming using IDE. JAVA JAVA IS A PROGRAMMING LANGUAGE AND A PLATFORM. IT CAN BE USED TO DELIVER AND RUN HIGHLY INTERACTIVE DYNAMIC.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing with Graphics.
Applets Yong Choi School of Business CSU, Bakersfield.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
TCL TK. Tcl/Tk C functions can become Tcl commands that are invoked interactively Tk = scriptable, portable user interface –Windows, X (Unix), MacOS,
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 5 Objectives  Learn about basic GUI components.  Explore how the GUI.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
An Overview of Tcl/Tk Programming. Tcl/Tk Tcl (Tool Command Language) is used by over half a million developers worldwide and has become a critical component.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
RAPID: THE RAPID ADA PORTABLE INTERFACE DESIGNER Martin Carlisle Department of Computer Science US Air Force Academy.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
GPS The GNAT Programming Studio GPS The GNAT Programming Studio Presentation cover page EU Vincent Celier FOSDEM 8-9 February 2009 Senior.
Applications Active Web Documents Active Web Documents.
Fundamentals of Programming I Overview of Programming
CST 1101 Problem Solving Using Computers
VBA - Excel VBA is Visual Basic for Applications
Chapter 21 – Graphics/Tk Outline 21.1 Introduction 21.2 GD Module: Creating Simple Shapes 21.3 GD Module: Image Manipulation 21.4 Chart Module 21.5 Introduction.
Introduction to Computer CC111
Console and GUI Programs
PHP / MySQL Introduction
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
NexTk/NtkWidget A replacement for Tk ?! 1.
Electronics II Physics 3620 / 6620
LING 408/508: Computational Techniques for Linguists
Event loops.
Presentation transcript:

9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley

9-Nov-97Tri-Ada '972 Premise Through a binding to Tcl/Tk, TASH provides the Ada programmer with an alternative to using the Windows 95 API: A free, platform-independent, graphical user interface development toolkit Supports native “look and feel” for the X Window System (Unix), Windows 95, and Macintosh.

9-Nov-97Tri-Ada '973 Outline What is TASH? What is Tcl/Tk? Why would I want to use TASH? Example of a using TASH to develop a GUI application in Windows 95

9-Nov-97Tri-Ada '974 What is TASH? TASH stands for Tcl Ada SHell An Ada 95 binding to Tcl/Tk 8.0 A layered approach: – Complete thin binding – Experimental thick binding

9-Nov-97Tri-Ada '975 What is Tcl/Tk? Tcl is a simple, powerful, and extensible scripting language similar to Unix shell scripting languages Tk is a GUI toolkit extension of Tcl Tk was originally targeted to X Window System, but now also supports Windows 95 and Macintosh native “look and feel” There is also a Tcl/Tk plugin for Web browsers

9-Nov-97Tri-Ada '976 Why use Tcl/Tk? Rapid development – Tcl is an interpreted language – Tk is a specialized extension for writing GUIs Platform independence System integration – Scripting languages, especially Tcl, are excellent for gluing together several programs and applications End-user programming – Tcl is an interpreted language – Tcl has a very simple syntax

9-Nov-97Tri-Ada '977 What does TASH do? Most importantly, it is a binding from Ada 95 Allows a Tcl program to use Ada in place of C to implement Tcl commands Makes the Tcl library functions available to an Ada program: – string and list handling – regular expression matching – hash tables – and, GUI development

9-Nov-97Tri-Ada '978 Why use TASH? Together with GNAT, it provides a free GUI development environment for Windows 95 Your code and interface design are completely portable to Unix and Macintosh

9-Nov-97Tri-Ada '979 Sample GUI Application A simple GUI application for computing future value of a series of fixed monthly investments will be demonstrated Future Value = where M = monthly investment i = interest rate per month n = number of months

9-Nov-97Tri-Ada '9710 Sample Screenshot

9-Nov-97Tri-Ada '9711 Pattern of a TASH Program Start Tcl Interpreter Initialize Tcl and Tk Create new Tcl commands Create GUI components Bind event handlers Start Tk event loop

9-Nov-97Tri-Ada '9712 Create GUI Components Window Manager Entry Button Frame Label

9-Nov-97Tri-Ada '9713 Create GUI Components Frame, Label and Entry Tcl.Tk.Create (Frame, ".amt", "-bd 2"); Tcl.Tk.Pack (Frame, "-side top -fill x"); Tcl.Tk.Create (Amt_Entry, ".amt.entry", "-width 20 -bg white"); Tcl.Tk.Pack (Amt_Entry, "-side right"); Tcl.Tk.Create (Label, ".amt.label", "-text {Monthly Savings Amount:}"); Tcl.Tk.Pack (Label, "-side right");

9-Nov-97Tri-Ada '9714 Create GUI Components Frame, Button, and Label Tcl.Tk.Create (Frame, ".fv", "-bd 2"); Tcl.Tk.Pack (Frame, "-side top -fill x"); Tcl.Tk.Create (Result, ".fv.result", "-width 20 -relief sunken"); Tcl.Tk.Pack (Result, "-side right"); Tcl.Tk.Create (Button, ".fv.button", "-text {Compute Future Value:} " & "-command computeFutureValue"); Tcl.Tk.Pack (Button, "-side right");

9-Nov-97Tri-Ada '9715 Create GUI Components Window Title and Focus -- Add a window title Tcl.Ada.Tcl_Eval (Interp, "wm title. {Future Value of Savings}"); -- Set focus to the first entry field Tcl.Ada.Tcl_Eval (Interp, "focus.amt.entry");

9-Nov-97Tri-Ada '9716 Create New Tcl Command declare package CreateCommands is new Tcl.Ada.Generic_Command (Integer); Command : Tcl.Tcl_Command; begin -- Create a new Tcl command to compute -- future value. Command := CreateCommands.Tcl_CreateCommand ( Interp, "computeFutureValue", Compute_Future_Value_Command'access, 0, NULL);

9-Nov-97Tri-Ada '9717 Create New Tcl Command Tcl calls Ada Subprogram function Compute_Future_Value_Command ( ClientData : in Integer; Interp : in Tcl.Tcl_Interp; Argc : in C.Int; Argv : in CArgv.Chars_Ptr_Ptr ) return C.Int; pragma Convention (C, Compute_Future_Value_Command); -- Declare a procedure, suitable for creating a -- Tcl command, which will compute the Future Value.

9-Nov-97Tri-Ada '9718 Create New Tcl Command Get the “Monthly Savings Amount” begin -- Compute_Future_Value_Command -- get the monthly investment amount from its text entry -- field, evaluate it in case it is an expression, -- and make sure it is not less than zero Amount := Money ( Tcl.Ada.Tcl_ExprDouble (Interp, Tcl.Tk.Get (Amt_Entry))); if Amount < 0.0 then return Tcl.TCL_OK; end if;

9-Nov-97Tri-Ada '9719 Create New Tcl Command Get the “Annual Interest Rate” -- get the annual interest rate from its text entry -- field, evaluate it in case it is an expression, -- and make sure it is not less than zero Annual_Rate := Float ( Tcl.Ada.Tcl_ExprDouble (Interp, Tcl.Tk.Get (Rate_Entry))); if Annual_Rate < 0.0 then return Tcl.TCL_OK; end if;

9-Nov-97Tri-Ada '9720 Create New Tcl Command Computing and Displaying Computed Future Value -- compute the monthly interest rate Rate := Annual_Rate / ; -- compute the number of months Months := Years * 12; -- compute future value Future_Value := Money (Float (Amount) * ((1.0 + Rate)**Months - 1.0)/Rate); -- put the future value into the result label Tcl.Tk.Configure (Result, "-text " & Money'image (Future_Value));

9-Nov-97Tri-Ada '9721 Bind Event Handlers -- Bind Return to the button command. -- If Button has focus, pressing Return will -- execute Tcl command, computeFutureValue Tcl.Tk.Bind (Button, " ", "computeFutureValue");

9-Nov-97Tri-Ada '9722 Start Tcl Interpreter and Initialize Tcl and Tk -- Create Tcl interpreter Interp := Tcl.Tcl_CreateInterp; -- Initialize Tcl if Tcl.Tcl_Init (Interp) = Tcl.TCL_ERROR then Text_IO.Put_Line ("FutureValue: Tcl_Init failed: " & Tcl.Ada.Tcl_GetResult (Interp)); return; end if; -- Initialize Tk if Tcl.Tk.Init (Interp) = Tcl.TCL_ERROR then Text_IO.Put_Line ("FutureValue: Tcl.Tk.Init failed: " & Tcl.Ada.Tcl_GetResult (Interp)); return; end if;

9-Nov-97Tri-Ada '9723 Start Tk Event Loop -- Loop inside Tk, waiting for events to occur and -- thus commands to be executed. -- When there are no windows left or when we execute -- “exit” command, Tcl.Tk.MainLoop returns. Tcl.Tk.MainLoop;

9-Nov-97Tri-Ada '9724 TASH GUI Components Inheritance Hierarchy

9-Nov-97Tri-Ada '9725 Tcl Interpreter Interaction

9-Nov-97Tri-Ada '9726 Summary TASH provides an alternative to using the Windows API for GUI development on Windows 95 Additional benefit: Tcl, a powerful, extensible scripting language – registry searching and editing tool – full set of file handling utilities – network programming, including http protocols Additional benefit: platform independence