Click here to Skip to main content
15,885,869 members
Articles / Desktop Programming / MFC

The ALXGrid Control Library.

Rate me:
Please Sign up or sign in to vote.
5.00/5 (29 votes)
10 Nov 20021 min read 200.5K   5.5K   85  
The ALXGrid Control Library is a set of classes for management of data as a table.
// GridDoc.cpp : implementation of the CGridDoc class
//

#include "stdafx.h"
#include "Grid.h"

#include "PaymentSet.h"
#include "GridDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGridDoc

IMPLEMENT_DYNCREATE(CGridDoc, CDocument)

BEGIN_MESSAGE_MAP(CGridDoc, CDocument)
	//{{AFX_MSG_MAP(CGridDoc)
		// 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
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGridDoc construction/destruction

CGridDoc::CGridDoc()
{
	// TODO: add one-time construction code here

}

CGridDoc::~CGridDoc()
{
	if(m_Set.IsOpen())
		m_Set.Close();
}

BOOL CGridDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CGridDoc serialization

void CGridDoc::Serialize(CArchive& ar)
{
}

/////////////////////////////////////////////////////////////////////////////
// CGridDoc diagnostics

#ifdef _DEBUG
void CGridDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CGridDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CGridDoc commands

BOOL CGridDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
/*
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
*/	
	DeleteContents();
	SetModifiedFlag(FALSE);     // start off with unmodified

	CWaitCursor WCur;

	if(m_Set.IsOpen())
		m_Set.Close();

	try
	{
		m_Set.m_strDefaultDBName = lpszPathName;
		m_Set.Open();
	}
	catch (CDaoException* e)
	{
		WCur.Restore();
		e->ReportError();
		e->Delete();
		return FALSE;
	}
	
	CGridApp* pApp = (CGridApp*)AfxGetApp();
	pApp->m_strDBName = lpszPathName;

	WCur.Restore();

	return TRUE;
}

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


Written By
Web Developer
Russian Federation Russian Federation
Year of birth - 1974.
Eeducation - was ended by Kaliningrad State University in 1997.
Now I work as the engineer-programmer in Kaliningrad (RUSSIA).

Comments and Discussions