C++ programming in Windows environment The Borland C++ Builder

Slides:



Advertisements
Similar presentations
Interaction Design: Visio
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Chapter 12 Creating and Using Templates. If you have already created and designed a page you like, you can use the layout and design for other pages in.
The Web Warrior Guide to Web Design Technologies
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Using the Visual Basic Editor Visual Basic for Applications 1.
ArcView Documents Francisco Olivera, Ph.D., P.E. Department of Civil Engineering Texas A&M University.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Lesson 9 Windows Management
A First Program Using C#
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
Microsoft Visual Basic 2005: Reloaded Second Edition
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
Lecture Set 2 Part B – Configuring Visual Studio; Configuration Options and The Help System (scan quickly for future reference)
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
MFC Windows Programming: Document/View Approach More detailed notes at: 360/notes-html/class15.htm.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
OCC Network Drives  H:\  P:\ 
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Using Xcode A Beginner’s Tutorial Erin Green. This tutorial will walk you through Xcode, a software development tool for Apple’s iOS applications – We.
Lection №5 Modern integrated development environment.
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
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.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Reading Flash. Training target: Read the following reading materials and use the reading skills mentioned in the passages above. You may also choose some.
Photoshop Image Slicing. Reasons to Image Slide To create links out of sliced images To optimise different areas. (flat areas of colour, such as logos,
4 Copyright © 2004, Oracle. All rights reserved. Creating a Basic Form Module.
Overview of Previous Lesson(s) Over View 3 Program.
© 2010 Delmar, Cengage Learning Chapter 11 Creating and Using Templates.
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
LC++ programming in Windows environment Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 10./0. lThe Visual Component Library.
Chapter 2 – Introduction to Windows Operating System II Manipulating Windows GUI 1CMPF112 Computing Skills for Engineers.
Dive Into® Visual Basic 2010 Express
Introduction to Computers
Microsoft Foundation Classes MFC
Creating a Flash Web Site
Forms Concepts Triggers Fired when Internal/External events occur
Object-Orientated Programming
Working in the Forms Developer Environment
The C++ programming language
Creating a Basic Form Module
Developer 2000 CSE 4504/6504 Lab.
Chapter Topics 15.1 Graphical User Interfaces
1. Introduction to Visual Basic
Understand Windows Forms Applications and Console-based Applications
Introduction to Computers
Lesson 9 Windows Management
Multi-form applications and dialogs
CIS16 Application Development Programming with Visual Basic
Event loops.
C++ programming in Windows environment
Lecture Set 11 Creating and Using Classes
PrognosTILs app Damien Drubay –
The Basic Usage and The Event Handling in Glade.
Teaching slides Chapter 6.
C++ programming in Windows environment
Chapter 15: GUI Applications & Event-Driven Programming
Constructors, GUI’s(Using Swing) and ActionListner
The C++ programming language
Java objects: a first view
University of Warith AL-Anbiya’a
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Event loops.
Tutorial 10 Automating Tasks with Macros
Presentation transcript:

C++ programming in Windows environment The Borland C++ Builder Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./0. C++ programming in Windows environment The Borland C++ Builder Building elements of the program: the components The Visual Component Library (VCL) Structure of VCL Application models handling single, or multiple documents (SDI, MDI) Project handling of C++ Builder The first steps of making an application

Building elements of the program: the components Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./1. Building elements of the program: the components The component is such an object (e.g. a button) that works already during planning, writing the program, consequently the values of its properties can be set without writing program code. From a lot of pre-programmed components realising given task the exactly required instance can be selected for the program. The components can easily be put on the form of designed window selecting them from the component-palette.

Department of Information Engineering INFORMATION TECHNOLOGY dr Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./2. The event is an occurrence, e.g. a button click by mouse, that comes from the user interaction or the Windows operating system. The list of events that can happen on a selected component (e.g. button) is given in the Events page of the Object Inspector. The handling of an event is performed by the event handler function of the component. The event handler is that from the member functions of the component affected by the event which starts to run because of the event and answers it (e.g. closes the window). The skeleton of the event handler function can be created in the program double clicking on the name of the selected event in the Events page. The internal code of the function that answers to the occurrence has to be written by us.

Department of Information Engineering INFORMATION TECHNOLOGY dr Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./3. The answering code has to be entered here by you! Double click on the name of the event and the skeleton of the event handler is ready.

Department of Information Engineering INFORMATION TECHNOLOGY dr Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./4. The components have non event handler member functions too, these functions are the methods. The methods can be called by us too in the code segment written by us. Among the methods there are the constructor and the destructor. E.g. the calling of the Focused() method answers the question is the control component in the focus, so it is selected for getting the effects originate from the user actions. In the working program the control which is in the focus is set off using framing, colouring or another method. In case of Properties, Events and Methods the Help informs us about the ancestor class where these characteristics were defined the first time, where they are inherited to the class of the object from.

Department of Information Engineering INFORMATION TECHNOLOGY dr Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./5. The Help gives detailed information about properties of every single class. Because of its complexity the C++ Builder is practically not usable without the online Help. Program examples support the understanding and application of components. A tutorial is included for beginners in the Help/C++ Builder Help/Contents/ Quick Start: Tutorials point. Example programs that introduce the possibilities of C++ Builder are in the Examples folder.

The Visual Component Library (VCL) Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./6. The Visual Component Library (VCL) As C++ Builder is suitable for writing programs that run on Windows graphical operating system and use the resources of Windows API, it is evident that includes a graphical object library which uses and simultaneously hides the API. The visual attribute means that these objects mostly displayed on the screen: window-forms, menus, input panels, controls, etc. For non visual objects an example is the timer. VCL classes are organised into a class hierarchy. The C++ Builder borrowed this structure from the Borland Delphi program development environment, that uses the Object Pascal programming language. The VCL provides the components to a quick build-up of Windows-style user interface but the internal program code that gives the essence of the application has to be entered using C++ language. The capabilities of Object Pascal based VCL have the next differences compared to possibilities of C++: The VCL objects have to be created dynamically (new, delete) The member functions of VCL objects have not default parameter values The VCL objects cannot have multiple ancestors.

Structure of VCL (detail) Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./7. Structure of VCL (detail) TObject TStream TPersistent TGraphic TComponent TStrings TControl TApplication TMenu TGraphicControl TWinControl TImage TShape TScrollingWinControl TCustomControl TButtonControl TCustomForm TButton TForm

TObject is the ancestor of VCL classes. Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./8. TObject is the ancestor of VCL classes. The descendants of TPersistent class can save and load their features to/from files. TComponent is the ancestor of components. Their descendants have properties and methods that make possible to install them into the Component Palette and to add them to forms. TControl is the ancestor class of controls appearing in the user interface. The instances of TApplication class are the applications. It has methods like Initialize(); CreateForm(); Run(); for control of the application and to handle the message transmitting cycle. They are called in WinMain() function. TForm is class of windows, the main window of the application, the dialog windows of the user interface are derived from it. The structure, the parts of the built window are included in the .DFM file, the program code regarding its work is in the .CPP file and the declarations are given in the .H header file. The programmer don’t have to deal with the .DFM file, its creation is automatic. Custom classes can constitute the basis class of classes built further from them by the programmer. These new classes are not given in the class hierarchy originally.

Application models handling single, or multiple documents (SDI, MDI) Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./9. Application models handling single, or multiple documents (SDI, MDI) The applications can be of two sorts: The SDI, Single Document Interface program can use countless further dialog and message windows over the main window, but can work on one document only. The MDI, Multiple Document Interface program can run countless further document windows in the main window that have the same structure and can display different documents. The menus and icons in the main window refers to the active document. E.g. remember the Windows/Tile function of Excel. The application model of the main window of our application can be selected by the FormStyle property of its form. The document windows of an MDI application are non modal windows: more than one can be opened at the same time, every can be selected clicking in it and can be used for work. Such windows have to be displayed calling their Show() method. Modal windows have to be closed before clicking effectively in another window of the application. Such windows applied in every application model: most of the dialog windows are such. This behaviour is caused by the ShowModal() method.

Project handling of C++ Builder Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./10. Project handling of C++ Builder The C++ Builder development environment administers the files created during developing process hidden in the project file (e.g. football.bpr). The starting file including the WinMain() function is made automatically. (e.g. FOOTBALL.cpp).

The Project Manager does not show the .h header files. Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./11. The units consist of a .cpp and a .h pair of files. In case of forms this pair is completed with a .dfm form-definition file that is made automatically. The Project Manager does not show the .h header files. The .res resource file and other, rare used files (.txt, .bmp, .wav) can be attached to the above mentioned files.

The first steps of making an application Department of Information Engineering INFORMATION TECHNOLOGY dr. László Dudás 33./12. The first steps of making an application 1. Create a new folder which will store the files of the project. 2. Start C++ Builder. 3. If a previous project were open choose the File/Close all menu item and close it. Then create a new project with the File/New Application menu point. The C++ Builder creates the next files automatically:   Project1.cpp : the main program   Unit1.cpp : the source code file for the main form that is named unit file   Unit1.h : the header file for the main form that is named unit header file   Unit1.dfm : resource file that describes the structure of the main form. 4. Choose the File/Save All menu item and save the files to the previously created folder. Rename the .bpr project file to taste during saving. The default names of units can be kept or renamed at will. 5. Later the full project has to be saved by the File/Save All menu item. This is expedient after every bigger modification.