Title: Programming with Graphical Components
1Programming with Graphical Components
Ragnar.Nohre_at_ing.hj.se
Project course
Demo-day Dec 9, 7 weeks from now
2Objectives
- Practice OO-programming
- Practice programming
- Reuse classes (graphical components)
- Learn how the OS interacts with a graphical app
- Event driven programming, etc
- Get experience in software development
3Topics of today
- Participants
- Course information
- Running a software project
- A simple MFC application (paint)
4Topics of today
- Participants
- Course information
- Running a software project
- A simple MFC application (paint)
5participants
LANDIN ANDERS LEXELL ERIK LI DEQING MARQUARDT
PATRIK MARTINEZ JORGE OJALA TOMI PAPAGEORGIOU
THEODORE PETERSSON ERIK RANDHAHN DIRK RUEGSEGGER
ADRIAN SACHS HOLGER SALZER MIKE SAVINON RIVERA
JOSÉ
LANDIN ANDERS LEXELL ERIK LI DEQING MARQUARDT
PATRIK MARTINEZ JORGE OJALA TOMI PAPAGEORGIOU
THEODORE PETERSSON ERIK RANDHAHN DIRK RUEGSEGGER
ADRIAN SACHS HOLGER SALZER MIKE SAVINON RIVERA
JOSÉ
AHMED GEILANI ARTURSSON ANDREAS BARO
JAMES BJÖRKETUN JOHN BUCHERER FELIX FJÄLLSTRÖM
ANTON FRASER PETER GUNNARSSON DAVID GUNNARSSON
ERIK HENRIKSSON VICTOR JUNGNELL JOHAN KRALJ
DANIJEL KÃœNG KLAUS
AHMED GEILANI ARTURSSON ANDREAS BARO
JAMES BJÖRKETUN JOHN BUCHERER FELIX FJÄLLSTRÖM
ANTON FRASER PETER GUNNARSSON DAVID GUNNARSSON
ERIK HENRIKSSON VICTOR JUNGNELL JOHAN KRALJ
DANIJEL KÃœNG KLAUS
6More participant
SCHECK ARNE STRÖBERG NICHLAS TAPPER
ROBBIN TASEVSKA EMILIA VLASTOS ALEXANDER WELTER
MARKUS YU FEI ÖZBEK FEDRA
SCHECK ARNE STRÖBERG NICHLAS TAPPER
ROBBIN TASEVSKA EMILIA VLASTOS ALEXANDER WELTER
MARKUS YU FEI ÖZBEK FEDRA
Someone else.
Someone else.
7Topics of today
- Participants
- Course information
- Running a software project
- A simple MFC application (paint)
8Course Information
- Programming language/environment
- Applications
- Project groups
- Gradings/scores (betyg)
9Programming language/environment
- Visual C/C
- - Win32
- - MFC
- Other?
- You need to convince me with a very good reason
- You are on your own
- I will ask you to give a seminar on your
programming environment -
10Visual C/C Win32 API
- You write all code by yourself
- You will learn how Windows works- Your
application will look less impressive
11Visual C using MFCMicrosoft Foundation Classes
- Take advantage of Microsoft's class library
- Take advantage of a program skeleton written by
AppWizard - Easy to make an application with a professional
look and feel - MFC is huge
- easy to use
- difficult to understand
12A popular book on MFC-programming(somewhat
outdated)
ISBN 0130166294 300 pages
akademibokhandeln!
13Applications
- Two options
- Choose and application from my list of project
ideas - Define your own application
- - And ask me if it is okay (you need to convince
me)
The application must use graphical components,
such as menus, dialog boxes, buttons,
list-boxes, etc.
14Project Groups
- 3 to 7 persons
- Equal skills in C programming
- Reading the same additional courses
15Urgent Actions before 1500 tomorrow
- Send me a mail and tell me about
- The group members
- The name of the group (if any)
- Programming environment (win32/MFC/(or ?))
- Your Application
If you like me to choose a group for you send me
a mail to tell me that you are taking this
course..
16Individual Grades/scores (betyg)
U, 3,4, or 5 (swed) ECTS (int)
17Gradings, the general idea
- 3.
- Your project succeeds
- You have been working actively in the project
(5x40200 h) - You have done some programming
- 4-5. as above, in addition you
- master C programming
- have knowledge in Windows programming (MFC or
win32)
18programming points
/
CALL int m Max(a,b) VERSION
2001-10-22 by NoRa/DuSt TASK Returns
the maximum of a and b.
/
Head 0-3 p
int Max(int a, int b) if (agtb) return
a else return b // Max
Code 0-5 p
If somebody has a bettersuggestion, please let
meknow!
19Topics of today
- Participants
- Course information
- Running a software project
- A simple MFC application (paint)
20Software development projects
This is extremely difficult
most industrial projects fail
The more persons involved, the more likely is
the project to fail
21The Project
Design
Development
Test
Demo-Day
Test Protocol
Design Doc.
Program
22Requirement specification
- Describe the application
- describe the purpose of the application
- illustrate the GUI by a figure
- how to use the application
- perhaps you need to discuss Use-cases/scenarios?
23Requirement specification
- It is a Contract
- You define what you will deliver
- Your customer (that is me) has to approve and
sign the spec - 7 weeks from now, your delivery has to match the
spec
hint dont promise too much
tip specify a basic functionality and
additional features
24The Time Plan
- Week 1 design
- Week 2 programming
- Week 3 programming
- Week 4 programming
- Week 5 programming
- Week 6 testing
BAD
25Purpose of the Time Plan
The purpose is to help you deliver on time At
any time, you should be able to match the status
of the project with the original time plan Are
we one-time, late or early? If we are late, what
actions must we take? A vague plan is useless!
26Tip Use aplhas!
Use the concept of alphas to denote releases
withincomplete functionality Example, consider
a car racing game
Alpha-1 The application displays the road and
the car, but the car cannot move Alpha-2
Animation implemented. The motion of the carcan
be controller by the player, but there is no
collision detection. Alpha-3 Collision-detection
and sound-effects implemented Alpha-4 The
loop-counter , the timer and the high-score list
implemented. Etc. Beta-1 Full functionality,
testing...
27Design
The design document will help you divide the work
between the group-members
- Design document (living document)
- High Level Design
- which classes/functions do we need?
- nams, interfaces, functional-descriptions,UML
Low Level Design implementation!
28When to start programming?Do we have to wait
until the development phase?
Try your tools, write a simple GUI-program! - How
else could you make a proper time plan?
Conduct experiments, try different solutions -
How else could you make a proper design?
29A typical week
M T W T F
S S
LAB
Sem?
Sem?
My main role is to assist you during the LAB-hours
30Course Plan
0800. I have defined the groups
Demoday
w43
w50
signed req spec and timeplan required
Before Wednesday 1500 you e-mail a
suggested list of group members to me
31Topics of today
- Participants
- Course information
- Running a software project
- A simple MFC application (paint)
32A simple paint application
33Old style development
REUSE modify a copy of an old program
old program
new program
Old program
34New style Development
Existing classbelonging to a class library
Typically, the overridden functions are invoked
from the existing code in the base-class
35Framework programmingframework arbetsram
Existing code that calls your functions
Overridden functions implemented by you!
Existing functions called by your code
36Appwizard creates an applicationcontaining 4
important objects
- application object
- frame object
- document object
- view object
Very important
37the document object
class CPaintDoc public CDocument ...
old stuff inheritedfrom CDocument
CPaintDoc -object
new stuff addedby me or Wizard
38the document object
the document-object represents the datathat is
manipulated by my paint-application
member functions to read and save from file, etc
CPaintDoc -object
vector of points (added by me)
39the view object
class CPaintView public CView ...
old stuff inheritedfrom CView
CPaintView -object
new stuff addedby me or Wizard
40the view object
the view-object represents the windowthat
displays the painting.
CPaintView -object
41Let us write some code...
- Let AppWizard create the application
- Play with OnDraw(..)
- to show you when this function is called we will
let it paint the window by a random color - Implement the application
- add the vector to the CPaintDocument class
- add OnMouseMove(..) to CPaintView
- edit the OnDraw(..) on CPaintView
42Add the data structure to the document class
include ltvectorgt typedef stdvectorltCPointgt
CVecPoint
class CPaintDoc public CDocument . //
Attributes public
CVecPoint m_vecPoint
43Add OnMoseMove to the view class
void CPaintViewOnMouseMove(UINT nFlags, CPoint
point) if (nFlags MK_LBUTTON) CVecPoint
v GetDocument()-gtm_vecPoint v.push_back(
point ) Invalidate(FALSE)
44Implement OnDraw()in the view class
void CPaintViewOnDraw(CDC pDC) CPaintDoc
pDoc GetDocument()
CVecPoint v pDoc-gtm_vecPoint CRect
rc(-4,-4,3,3) pDC-gtSelectStockObject(BLACK_BRUSH
) for (CVecPointiterator iv.begin()
i!v.end() i) CPoint pt i
pDC-gtEllipse(rc pt)
45Topics of today
- Participants
- Course information
- Running a software project
- A simple MFC application (paint)
46Urgent Actions before 1500 tomorrow
- Send me a mail and tell me about
- The group members
- The name of the group (if any)
- Programming environment (win32/MFC/(or ?))
- Your Application
If you like me to choose a group for you send me
a mail...