Graphics Reference
In-Depth Information
class CTutorialDlg : public CDialog {
. // removed content similar to that from Listing 2.4 (Tutorial 2.1) .
A1: int m _ OkCount; // count of "Click to Add" button is clicked
B1: afx _ msg void OnBnClickedBtnAdd(); // "Click to Add" service routine
C1: CString m _ EchoText; // For controling the output GUI element
};
. // removed content similar to that from Listing 2.4 (Tutorial 2.1) .
BOOL CTutorialDlg:: OnInitDialog () {
A2: m _ OkClick = 0; // initialize application state.
.
BEGIN _ MESSAGE _ MAP(CTutorialDlg, CDialog)
Source file.
TutorialDlg.h/cpp
file in the Source and
Header files folders of
the MFC _ EchoButtonEvent
project.
B2: ON _ BN _ CLICKED(IDC _ BTN _ ADD, OnBnClickedBtnAdd)
.
void CTutorialDlg:: DoDataExchange (CDataExchange * pDX) {
C2: DDX _ Text(pDX, IDC _ ECHO _ AREA, m _ EchoText);
.
B3: This is the “Click to Add” button service routine that we have registered
with the MFC.
void CTutorialDlg:: OnBnClickedBtnAdd () {
A3: m _ OkCount++; // update application state
C3: m _ EchoText.Format(" % d", m _ OkCount); // convert to text for output
C4: UpdateData(FALSE); // flush count to window
.
Listing 2.6. CTutorialDlg class (Tutorial 2.2).
In addition, following the naming convention of the source code files, we notice
TutorialApp.h/.cpp defining the application and TutorialDlg.h/.cpp defin-
ing the main application window. When we compare the TutorialDlg.h/.cpp
with those from Tutorial 2.1, we notice slight differences. These differences are
the implementation of the functionality in Tutorial 2.2. Listing 2.6 highlights
these differences. From Listing 2.6, we notice the following.
Application state (A). As defined by the solution from Listing 2.5, at label
A1 the application state is defined as an integer. At label A2, the application
Search WWH ::




Custom Search