|
IDD_BOOK dialog , the design ...
1st Page selected of Tab Control ...
|
2nd Page selected of Tab Control ... |
 |
 |
|
This software use the command -
GetCurrentDirectory
(to get the name of the current directory)
In this Form used the following database classes -
CDaoDatabase and CDaoRecordset
In the file stdafx.h add the
MFC database
support - afxdao.h
Add
Picture Files
- From the
CD-Rom - Teach_VNet, copy the
bmp files diamp1.bmp, bitmap4.bmp and
bitmap5.bmp
(\\C_Col_VC++Net\KJV_VCNet\res\ingraphic1.bmp)
to the folder - c:\KJV_VCNet\res
- On the
Projet menu , click Add Resource,
Add Resource dialog box appears, select
Bitmap, click Import, Import
dialog box appears, select the file
diamp1.bmp of the folder
c:\KJV_VCNet\res, and then click Open.
New
item - IDB_BITMAP3 added to the
Bitmap folder of Resource View
- On the
Projet menu , click Add Resource,
Add Resource dialog box appears, select
Bitmap, click Import, Import
dialog box appears, select the file
bitmap4.bmp of the folder
c:\KJV_VCNet\res, and then click Open.
New
item - IDB_BITMAP4 added to the
Bitmap folder of Resource
View
- On the
Projet menu , click Add Resource,
Add Resource dialog box appears, select
Bitmap, click Import, Import
dialog box appears, select the file
bitmap5.bmp of the folder
c:\KJV_VCNet\res, and then click Open.
New
item - IDB_BITMAP5 added to the
Bitmap folder of Resource
View
| | |
IDD_BOOK, add controls by step
The Dialog
Properties
Caption:
Center:
ID:
Menu:
Maximize Box: |
Book ...
True
IDD_BOOK
False |
|
Delete the Button control -
IDCANCEL |
1st step |
...
1. |
The Dialog
design
|
2. |
From the Toolbox/Dialog Editor add
the following control to
IDD_BOOK
Tree Picture
controls, eight
Text controls, one Edit control and one
Tab control
The controls Properties
- 4
Button
controls
1. |
Caption:
ID: |
|<
IDC_FIRST |
|
|
2. |
Caption:
ID: |
<<
IDC_PREVIOUS |
|
|
3. |
|
4. |
Caption:
ID: |
>|
Verse:
IDC_LAST |
|
|
- 3 Picture
controls
1. |
ID:
Image:
Type: |
IDC_STATIC
IDB_BITMAP3
Bitmap |
|
IDB_BITMAP6 = bmp file - diamp1.bmp
|
2. |
ID:
Image:
Type: |
IDC_STATIC
IDB_BITMAP4
Bitmap |
|
IDB_BITMAP6 = bmp file - bitmap4.bmp
|
3. |
ID:
Image:
Type: |
IDC_STATIC
IDB_BITMAP5
Bitmap |
|
IDB_BITMAP6
= bmp file - bitmap5.bmp |
- Edit control
Align Text:
ID:
MultLine:
Read Only: |
Left
IDC_EDIT1
True
True |
|
- Tab control
ID:
Style: |
IDC_TAB1
Right Justify |
|
- 8 Text
controls
1. |
Align
Text:
Caption:
ID: |
Left
Book:
IDC_STATIC |
|
|
2. |
Align
Text:
Caption:
ID: |
Left
IDC_BOOK |
|
|
3. |
Align
Text:
Caption:
ID: |
Left
Title:
IDC_STATIC |
|
|
4. |
Align
Text:
Caption:
ID: |
Left
IDC_TITLE |
|
|
5. |
Align
Text:
Caption:
ID: |
Left
Chapter:
IDC_STATIC |
|
|
6. |
Align
Text:
Caption:
ID: |
Left
IDC_CHAPTER |
|
|
7. |
Align
Text:
Caption:
ID: |
Left
Verse:
IDC_STATIC |
|
|
8. |
Align
Text:
Caption:
ID: |
Left
IDC_VERSE |
|
|
|
|
3. |
Add Variable
...
On the
View menu , click Resource View, in the
Resource View - KJV_VCNet dialog box appears,
expand KJV_VCNet , expand Dialog
folder and click IDD_BOOK
1. |
- Select
and right click the Text control -
IDC_BOOK, select
Add variable ... on the shortcut
menu, the Add Member Variable Wizard -
KJV_VCNet dialog box appears.
- In this
dialog ...
- In the
Control ID box , display
IDC_BOOK
- In the
Control type box , display LTEXT
- In the
Category box, select Value
- In the
Variable name box, type mm_book
- Click
Finish. new text codes to be added
to the files:
- In
the Book.h
CString mm_book;
- In the
Book.cpp
, mm_book(_T(""))
DDX_Text(pDX, IDC_BOOK, mm_book);
|
|
Use these steps
to add a member Varaiable for other
controls
|
other |
Repeat
all steps of point 1 to
add a member Varaiable for other
controls:
Control ID
|
Control
Type |
Category |
Variable
name |
IDC_EDIT2
IDC_EDIT2
IDC_DISPLAY
IDC_LIST
IDC_FOUND
IDC_FOUND |
EDIT
EDIT
BUTTON
SysListView32
LTEXT
LTEXT |
Control
Value
Control
Control
Control
Value |
m_edit2control
m_edit2
m_display
m_list1
m_foundcontrol
m_found
|
|
With this work,
new text codes to be added to the files:
Book.h and Book.cpp |
|
4. |
Add Events
On the View menu , click
Resource View, in the Resource View - KJV_VCNet dialog
box appears, expand KJV_VCNet , expand Dialog
folder and click
IDD_BOOK
1. |
- In the
IDD_BOOK dialog
displays, select and right click the
Button cotrol IDC_FIRST, select Properties on the
shortcut menu, in the Properties dialog box appears, click
Control Events icon, from the dialog box appears
select event BN_CLICKED and add event OnBnClickedFirst.
New text codes to be created in the file
- In the Book.h
afx_msg void OnBnClickedFirst();
- In the Book.cpp
ON_BN_CLICKED(IDC_FIRST, OnBnClickedFirst
void
CBook::OnBnClickedFirst()
{
//
TODO: Add your control notification handler code here
}
|
Use these steps
to add an event for other
controls
|
other |
Repeat all steps of
point 1 to add an evente for other
controls:
Control ID
|
Select
event
|
Add event
|
IDC_PREVIOUS - (Button)
IDC_NEXT - (Button)
IDC_LAST - (Button)
IDC_TAB1 - (Tab) |
BN_CLICKED
BN_CLICKED
BN_CLICKED
TCN_SELCHANGING |
OnBnClickedPrevious
OnBnClickedNext
OnBnClickedLast
OnTcnSelChangeTab1 |
|
With this work,
new text codes to be added to the files:
Book.h and Book.cpp |
|
|
2nd step |
1
1. |
The
Dialog design
|
2. |
From the
Toolbox/Dialog Editor add the following control to
IDD_BOOK
Two
Text controls, one Edit control, one Button control and one
List control
The controls Properties
- 1
Button control
Caption:
ID: |
Display
IDC_DISPLAY |
|
|
- 1 List
control
ID:
View: |
IDC_LIST1
Report |
|
|
- 1 Edit control
Align
Text:
ID:
MultLine: |
Left
IDC_EDIT2
False |
|
- 2 Text
controls
1
1. |
Align
Text:
Caption:
ID: |
Left
Type the ...
IDC_TYPE |
|
|
2. |
Align
Text:
Caption:
ID: |
Left
IDC_FOUND |
|
|
|
|
3. |
Add
Variable ...
On the
View menu , click Resource View, in the
Resource View - KJV_VCNet dialog box appears,
expand KJV_VCNet , expand Dialog
folder and click IDD_BOOK
1. |
- Select
and right click the Text control -
IDC_TYPE, select
Add variable ... on the shortcut
menu, the Add Member Variable Wizard -
KJV_VCNet dialog box appears.
- In this
dialog ...
- In the
Control ID box , display or select
IDC_TYPE
- In the
Control type box , display LTEXT
- In the
Category box, select
Control
- In the
Variable name box, type m_type
- Click
Finish. new text codes to be added
to the files:
-
In the Book.h
CStatic m_type;
-
In the Book.cpp
DDX_Control(pDX, IDC_TYPE, m_type);
|
|
Use these steps
to add a member Varaiable for other
controls
|
other
|
Repeat
all steps of point 1 to
add a member Varaiable for other
controls:
Control
ID
|
Control
Type |
Category |
Variable
name |
IDC_EDIT2
IDC_EDIT2
IDC_DISPLAY
IDC_LIST1
IDC_FOUND
IDC_FOUND |
EDIT
EDIT
BUTTON
SysListView32
LTEXT
LTEXT |
Control
Value
Control
Control
Control
Value |
m_edit2control
m_edit2
m_display
m_list1
m_foundcontrol
m_found
|
|
With this work,
new text codes to be added to the files:
Book.h and Book.cpp
|
|
4. |
Add
Events
On the View menu , click
Resource View, in the Resource View - KJV_VCNet dialog
box appears, expand KJV_VCNet , expand Dialog
folder and click
IDD_BOOK
1. |
- In the
IDD_BOOK dialog displays, select and
right click the Button cotrol IDC_EDIT2, select
Properties on the shortcut menu, in the
Properties dialog box appears, click Control
Events icon, from the dialog box appears select
event EN_CHANGE and add event
OnEnChangeEdit2.
New text codes to be created in the file
- In the
Book.h
afx_msg void OnEnChangeEdit2();
- In the
Book.cpp
ON_EN_CHANGE(IDC_EDIT2, OnEnChangeEdit2)
void CBook::OnEnChangeEdit2()
{
// TODO: If this is a RICHEDIT control, the
control will not
// send this notification unless you override the
CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler
code here
}
|
Use these
steps to add an event for other controls
|
other |
Repeat all steps
of point 1 to add an evente for other controls:
Control ID
|
Select
event
|
Add event
|
IDC_DISPLAY - (Button)
IDC_LIST - (List) |
BN_CLICKED
MN_CLICK |
OnBnClickedDisplay
OnNMClickList1 |
|
With this
work, new text codes to be added to the files:
Book.h and Book.cpp |
|
|
3th step |
1. |
The
Dialog design
|
2. |
From the
Toolbox/Dialog Editor add the following control to
IDD_BIOGRAPHY
Five
Text controls and four ListBox control
The controls Properties
- 4
ListBox controls
1. |
ID:
Selection: |
IDC_LIST_BOOK
Single |
|
|
2. |
ID:
Selection: |
IDC_LIST_CHAPTER
Single |
|
|
3. |
ID:
Selection: |
IDC_LIST_TITLE
Single |
|
|
4. |
ID:
Selection: |
IDC_LIST_VERSE
Single |
|
|
- 5 Text
controls
1. |
Align
Text:
Caption:
ID: |
Left
Book
IDC_TBOOK |
|
|
2. |
Align
Text:
Caption:
ID: |
Left
Chapter
IDC_TCHAPTER |
|
|
3. |
Align
Text:
Caption:
ID: |
Left
Title:
IDC_TTITLE |
|
|
4. |
Align
Text:
Caption:
ID: |
Left
Verse
IDC_TVERSE |
|
|
5. |
Align
Text:
Caption:
ID: |
Left
Select ...
IDC_SELECT |
|
|
|
|
3. |
Add
Variable ...
On the
View menu , click Resource View, in the
Resource View - KJV_VCNet dialog box appears,
expand KJV_VCNet , expand Dialog
folder and click IDD_BOOK
1. |
- Select and
right click the Text control - IDC_SELECT,
select Add variable ... on the
shortcut menu, the Add Member Variable Wizard -
KJV_VCNet dialog box appears.
- In this
dialog ...
- In the
Control ID box , display or select IDC_SELECT
- In the
Control type box , display LTEXT
- In the
Category box, select
Control
- In the
Variable name box, type m_select
- Click
Finish. new text codes to be added to
the files:
- In
the Book.h
CStatic m_select;
- In
the Book.cpp
DDX_Control(pDX, IDC_SELECT, m_select);
|
|
Use these
steps to add a member Varaiable for other controls
|
other
|
Repeat all steps of point 1 to add a member
Varaiable for other controls:
Control ID
|
Control
Type |
Category |
Variable
name |
IDC_LIST_BOOK
IDC_LIST_CHAPTER
IDC_LIST_TITLE
IDC_LIST_VERSE
IDC_TBOOK
IDC_TCHAPTER
IDC_TTITLE
IDC_TVERSE |
LISTBOX
LISTBOX
LISTBOX
LISTBOX
LTEXT
LTEXT
LTEXT
LTEXT |
Control
Control
Control
Control
Control
Control
Control
Control |
m_listbook
m_listchapter
m_listtitle
m_listverse
m_tbook
m_tchapter
m_ttitle
m_t verse |
|
With this work, new
text codes to be added to the files: Book.h
and Book.cpp
|
|
4. |
Add
Events
On the View menu , click
Resource View, in the Resource View - KJV_VCNet dialog
box appears, expand KJV_VCNet , expand Dialog
folder and click
IDD_BOOK
1. |
- In the
IDD_BOOK dialog displays, select and
right click the Button cotrol IDC_LIST_BOOK,
select Properties on the shortcut menu, in the
Properties dialog box appears, click Control
Events icon, from the dialog box appears select
event LBN_SELCHANGE and add event
OnLbnSelChangeListBook.
New text codes to be created in the file
- In the
Book.h
afx_msg void OnLbnSelchangeListBook();
- In the
Book.cpp
ON_LBN_SELCHANGE(IDC_LIST_BOOK,
OnLbnSelchangeListBook)
void
CBook::OnLbnSelchangeListBook(){
// TODO: Add
your control notification handler code here
}
|
Use these
steps to add an event for other controls
|
other |
Repeat all steps
of point 1 to add an evente for other controls:
Control ID
|
Select
event
|
Add event
|
IDC_LIST_
CHAPTER - (ListBox)
IDC_LIST_TITLE -
(ListBox)
IDC_LIST_VERSE -
(ListBox) |
LBN_SELCHANGE
LBN_SELCHANGE
LBN_SELCHANGE |
OnLbnSelChangeListChapter
OnLbnSelChangeListTitle
OnLbnSelChangeListVerse |
|
With this
work, new text codes to be added to the files:
Book.h and Book.cpp |
|
|
|
|
|