Click here to Skip to main content
15,898,134 members
Articles / Desktop Programming / MFC

The Ultimate Grid Home Page

,
Rate me:
Please Sign up or sign in to vote.
5.00/5 (122 votes)
14 Sep 2013CPOL10 min read 4.6M   82K   418  
The Ultimate Grid is now Open Source
/*************************************************************************
				Class Declaration : CUpdatedRow
**************************************************************************
	Source file : UpdatedRow.cpp
	Header file : UpdatedRow.h

// This software along with its related components, documentation and files ("The Libraries")
// is � 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is
// governed by a software license agreement ("Agreement").  Copies of the Agreement are
// available at The Code Project (www.codeproject.com), as part of the package you downloaded
// to obtain this file, or directly from our office.  For a copy of the license governing
// this software, you may contact us at legalaffairs@codeproject.com, or by calling 416-849-8900.

	Purpose
		The CUpdatedRow class is a helper class of the ADO datasource which
		is used to temporarly store changes user makes to a single row.  These
		changes will later be set to the database when user moves off the record
		in the database, or closes the Ultimate Grid window.
*************************************************************************/

#ifndef _UpdatedRow_H_
#define _UpdatedRow_H_

class CUpdatedRow  
{
public:
	CUpdatedRow();
	virtual ~CUpdatedRow();

	// access functions used to set and get information
	// on row number that is currently updated
	inline long GetUpdateRowNumber(){	return m_rowNumber;	}
	inline void SetUpdateRowNumber( long row )
	{
		if ( m_rowNumber != row )
			Empty();

		m_rowNumber = row;
	}
	// access function used to determine if there is new
	// value for given column
	BOOL IsUpdated( int col );
	// function to retrieve count of new values in the list
	int Count();
	// access function used to retrieve new cell' data
	_variant_t GetUpdatedVal( int col );
	// function used to set new value
	int UpdateCell( int col, _variant_t newVal );
	// function to remove given 
	int RemoveNewVal( int col );
	// delete all items in the list
	int Empty();
private:
	typedef struct _tagColList
	{
		int			colNumber;
		_variant_t	newVal;
		// pointer to next element in the list
		struct _tagColList *next;

		// default constractor
		_tagColList()
		{
			next = NULL;
		}
	}ColList;

protected:
	ColList	*m_pColListHead;
	int m_rowNumber;
};

#endif // _UpdatedRow_H_

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
This is a Organisation

476 members

Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions