Docsity

Purdue ECET 455: C++ Object Oriented Programming - Creating a Windows Application - Prof. , Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
Purdue University Calumet Department of Electrical and Computer
Engineering Technology ECET 455 C++ Object Oriented Programming
Page 1 of 3
LECTURE_00
Task Definition:
The form as the object is used and its property CAPTION is being modified (changed)
and the event is mouse click anywhere on the Form.
Detailed Procedures & Explanatory Notes:
NOTE: pay particular attention to this procedure as the following labs will not go
this much detailed.
1) Open the Borland Builder.
2) An empty Form is always presented (the object).
3) Let us explore the form
4) You can click the Run button of the tool bar or hit F9 \ to execute the program.
5) Click Run button.
6) A Full blown Window opens up. You have compiled a true Windows Application
Program, with Minimize, Maximize and Close buttons. This would react to these
buttons just like any other windows based GUI program would work.
7) Minimize the application.
8) You discover a window named Unit1.cpp with c++ code, this corresponds to the
code which has gener5ated our application.
9) Maximize the Form.
10) Close the application from FILE->Close ALL.
11) Let us again start another application, by FILE->NEW APPLICATION.
12) A new File is always presented for our immediate use.
13) We have two types of settings, a) Design typesetting b) Run type setting.
14) As we start we are in the design type setting. When we RUN and compile the
application we are in the Run type setting.
15) In the Design typesetting when we are working with the Form, and we are
dropping the objects etc. we are in the Graphical design mode.
16) Hit F12. We see the code window with Unit1.cpp opens. If we work in this
window we are working in the code design mode.
17) F12 toggles between the graphical and code design modes.
18) Right click on the Unit1 code window and click on the Source/Header File(F6).
19) Another window opens up, this is header file for the Unit1.cpp file.
20) Go to VIEW->UNITS->Project1 and then OK.
21) Another Window opens, this has the file Project1.cpp. This has the Winmain()
function, Windows equivalent to main() function, this file starts the application.
These three files Unit1.cpp, Unit1.h, and Project1.cpp are responsible for the
Form1.
pf3

Partial preview of the text

Download Purdue ECET 455: C++ Object Oriented Programming - Creating a Windows Application - Prof. and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Engineering Technology ECET 455 C++ Object Oriented Programming

LECTURE_

Task Definition:

The form as the object is used and its property CAPTION is being modified (changed) and the event is mouse click anywhere on the Form.

Detailed Procedures & Explanatory Notes:

NOTE: pay particular attention to this procedure as the following labs will not go this much detailed.

  1. Open the Borland Builder.
  2. An empty Form is always presented (the object).
  3. Let us explore the form
  4. You can click the Run button of the tool bar or hit F9 \ to execute the program.
  5. Click Run button.
  6. A Full blown Window opens up. You have compiled a true Windows Application Program, with Minimize, Maximize and Close buttons. This would react to these buttons just like any other windows based GUI program would work.
  7. Minimize the application.
  8. You discover a window named Unit1.cpp with c++ code, this corresponds to the code which has gener5ated our application.
  9. Maximize the Form.
  10. Close the application from FILE->Close ALL.
  11. Let us again start another application, by FILE->NEW APPLICATION.
  12. A new File is always presented for our immediate use.
  13. We have two types of settings, a) Design typesetting b) Run type setting.
  14. As we start we are in the design type setting. When we RUN and compile the application we are in the Run type setting.
  15. In the Design typesetting when we are working with the Form, and we are dropping the objects etc. we are in the Graphical design mode.
  16. Hit F12. We see the code window with Unit1.cpp opens. If we work in this window we are working in the code design mode.
  17. F12 toggles between the graphical and code design modes.
  18. Right click on the Unit1 code window and click on the Source/Header File(F6).
  19. Another window opens up, this is header file for the Unit1.cpp file.
  20. Go to VIEW->UNITS->Project1 and then OK.
  21. Another Window opens, this has the file Project1.cpp. This has the Winmain() function, Windows equivalent to main() function, this file starts the application. These three files Unit1.cpp, Unit1.h, and Project1.cpp are responsible for the Form1.

Engineering Technology ECET 455 C++ Object Oriented Programming

  1. Let us save our project before we go any further. In fact as soon as we open a NEW PROJECT, we should proceed with saving it. (Please follow this procedure exactly).
  2. Go to FILE->SAVE ALL
  3. Create a new Folder, in the path (c:\Program Files\Borland\Cbuilder5\Projects) say with a name like: ECET455_Lab_0.
  4. Transfer to the new Folder.
  5. Save with the default names twice, first Unit1.cpp and next Project1.bpr.
  6. In your course of the Application Design often does the FILE->SAVE ALL.
  7. Later on at any time if you need to go back again: FILE->OPEN PROJECT->PROJECT1.bpr, would start you in this project.
  8. Use Window’s Explorer to exam the files that are being generated. They are as follows:
  9. Project1.bpr
  10. Project1.cpp
  11. Project1.res
  12. Unit1.cpp
  13. Unit1.dfm
  14. Unit1.dfm These are the six essential files that you need to save at the end of your session if you want to save your precious, priceless, one of a kind: Windows Software Application Design.
  15. If you run the application the compiler generates a host of other files along with Project1.exe file. If you wish to save this save this too. If you notice the files size they are not very bulky. Most of our class projects (say 15 – 20) could all fit on a 3 ½ Disk.
  16. Emphasizing, again follow the items (24- 31) as soon as you start your new application. This will save a lot of headache later. Always have your work in the hard drive and only transfer the folder with the essential files to other medium later at the very end.
  17. Summarizing let us go back to our application there are three associated code windows: Unit1.cpp, Project1.cpp and Unit1.h, they are associated with the Form1. You could toggle back and forth from Unit1.cpp and Unit1.h to Form1.
  18. So far we have designed a true Windows GUI Application that has a single embedded Window as an Object (component).
  19. Each Object 1) Senses the event(s) in its environment 2) Thinks (or behaves) and 3) act.
  20. Go to the Object Inspector: We have our Object-component listed. It has its associated Properties and Events.
  21. The Component (Object) senses the event(s), the Properties control its thinking and behavior and the method(s) [in c lexicon function(s)] control its action.
  22. Going Little Deeper………