Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

CTreeView Iterator

, 27 Mar 2002
An iterator to parse subtree and execute function on each item/node
ctreeview_iterator_demo.zip
Debug
res
CodeProjectSample.aps
CodeProjectSample.clw
CodeProjectSample.dsp
CodeProjectSample.dsw
CodeProjectSample.ncb
CodeProjectSample.opt
CodeProjectSample.plg
CodeProjectSample.positions
CodeProjectSample.ico
CodeProjectSampleDoc.ico
Toolbar.bmp
ctreeview_iterator_src.zip
// CodeProjectSampleView.cpp : implementation of the CCodeProjectSampleView class
//

#include "stdafx.h"
#include "CodeProjectSample.h"

#include "CodeProjectSampleDoc.h"
#include "CodeProjectSampleView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCodeProjectSampleView

IMPLEMENT_DYNCREATE(CCodeProjectSampleView, CEditView)

BEGIN_MESSAGE_MAP(CCodeProjectSampleView, CEditView)
	//{{AFX_MSG_MAP(CCodeProjectSampleView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCodeProjectSampleView construction/destruction

CCodeProjectSampleView::CCodeProjectSampleView()
{
	// TODO: add construction code here

}

CCodeProjectSampleView::~CCodeProjectSampleView()
{
}

BOOL CCodeProjectSampleView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CEditView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCodeProjectSampleView drawing

void CCodeProjectSampleView::OnDraw(CDC* pDC)
{
	CCodeProjectSampleDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

}

void CCodeProjectSampleView::OnInitialUpdate()
{
	CEditView::OnInitialUpdate();

	CSize sizeTotal;
	// TODO: calculate the total size of this view
	sizeTotal.cx = sizeTotal.cy = 100;
	
}

/////////////////////////////////////////////////////////////////////////////
// CCodeProjectSampleView printing

BOOL CCodeProjectSampleView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CCodeProjectSampleView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CCodeProjectSampleView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CCodeProjectSampleView diagnostics

#ifdef _DEBUG
void CCodeProjectSampleView::AssertValid() const
{
	CEditView::AssertValid();
}

void CCodeProjectSampleView::Dump(CDumpContext& dc) const
{
	CEditView::Dump(dc);
}

CCodeProjectSampleDoc* CCodeProjectSampleView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCodeProjectSampleDoc)));
	return (CCodeProjectSampleDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCodeProjectSampleView message handlers

void CCodeProjectSampleView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// if event is new list to display
	if(lHint==1L)
	{
		// get control
		CEdit& theEdit = GetEditCtrl();

		// retrieve text
		sListToDisplay = ((CString*)pHint)->GetBuffer(0);
		
		// set text
		theEdit.SetWindowText(sListToDisplay);

		// to be sure to display it
		this->Invalidate();
	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Julien Martino
Web Developer
France France
After years passed in services companies, I now work for Euromaster, an international group dedicated to vehicules maintenance. I also develop for my own usage. I both use Java and C++ languages and now, I integrate XML documents and XSL syntax in my applications even if SQL Databases like Oracle remain my main data sources

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411019.1 | Last Updated 28 Mar 2002
Article Copyright 2002 by Julien Martino
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid