CHKBOOK

The CHKBOOK sample demonstrates how to simulate multiple views in Windows CE by hiding/showing windows. (Windows CE doesn't support Multi-Document Interface (MDI).)

There is only one view of the document, implemented in class CCheckBookView. To enter or view data for a single check, select the menu item View Check, and a dialog is displayed. To show a summary of each check in the checkbook, select the menu item View Book, and an edit window is displayed. The two views cannot be seen at the same time, but you can toggle between them.

You can change the current selection in the checkbook view by using the menu items Previous and Next, or by tapping a check item with the stylus. The check view always shows the current selection in the checkbook view.

The check amount field in the check form view validates and converts a textual representation such as "19.98" to an internal DWORD representation. CHKBOOK does not do arithmetic, but it easily could be extended to add up all the check amounts and display the total on a bottom line.

Record-Based Document

A record-based document is one whose persistent data is updated each time the user adds, deletes, or modifies some portion of its data. This requires overriding the framework's default implementation for file-based documents. The default behavior is to read a file entirely into memory upon File Open and write it entirely back to the disk on File Close.

CHKBOOK Simplifications

The CHKBOOK sample has several simplifications to keep the code focused on MFC features and techniques the sample is designed to illustrate. For example:

This sample demonstrates the following keywords:

CArchive::IsStoring CString::Format
CCmdUI::Enable CString::LoadString
CCmdUI::SetCheck CString::GetLength
CDC::GetTextMetrics CString::Left
CDataExchange::Fail CWinApp::AddDocTemplate
CDataExchange::PrepareEditCtrl CWinApp::OnFileNew
CDialog::DoModal CWnd::Create
CDocument::GetFirstViewPosition CWnd::DoDataExchange
CDocument::GetNextView CWnd::GetClientRect
CEdit::CharFromPos CWnd::MessageBox
CEdit::LineIndex CWnd::OnShowWindow
CEdit::SetSel CWnd::SendMessage
CEdit::SetTabStops CWnd::SetFocus
CFile::Close CWnd::SetWindowText
CFile::Open CWnd::ShowWindow
CFile::Read CWnd::UpdateData
CFile::Seek CWnd::UpdateWindow
CFile::Write AfxMessageBox
CFrameWnd::AddAdornments GetWindowText
CFrameWnd::GetActiveDocument SetWindowText
CFrameWnd::InsertButtons _tcslen
CObject::AssertValid _ttoi
CObject::Dump _ttol
CObject::IsKindOf

You can find the CHKBOOK project files in the Wce\Samples\Mfc\CHKBOOK directory.

To build the CHKBOOK sample, follow the procedure described in Building the Sample Applications, selecting one or more of the following project configurations.