A SERVICE OF

logo

document’ DeleteLine function, passing it the index of the currentlys
selected line. This function should look like this:
void TDrawListView::CmDelete()
{
DrawDoc->DeleteLine(GetSelIndex());
}
Y u also need functions to handle the CM_CLEAR and CM_UNDOo
events for TDrawListView. If the user chooses the Clear menu
command, the view receives a CM_CLEAR message. All it needs to
do is call the document’ Clear function:s
void TDrawListView::CmClear() {
DrawDoc->Clear();
}
If the user chooses the Clear menu command, the view receives a
CM_UNDO message. All it needs to do is call the document’ Undos
function:
void TDrawListView::CmUndo()
{
DrawDoc->Undo();
}
These functions are identical to the TDrawView versions of the same
functions. That’ because these operation rely on TDrawDocument tos
actually make the changes to the data.
Like the TDrawView class, TDrawListView VnCommit function alwayss
returns TRUE. In a more complex application, this function would
add any cached data to the document, but in this application, the data
is added to the document as each line is drawn.
The VnRevert function calls the LoadData function to revert the list box
display to the data contained in the document:
BOOL TDrawListView::VnRevert(BOOL /*clear*/)
{
LoadData();
return TRUE;
}
The VnAppend function gets a single unsigned int parameter which,
gives the index number of the appended line. Y u need to get theo
new line from the document by calling the document’ GetLines
function. Call the FormatData function with the line and the line index
passed into the function. After formatting the line, set the selection
index to the new line and return. The function should look like this:
Chapter 2, Learning ObjectWindows
115