home *** CD-ROM | disk | FTP | other *** search
- // mygrivw.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "mygrid.h"
- #include "mygrivw.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMygridView
-
- IMPLEMENT_DYNCREATE(CMygridView, CFormView)
-
- CMygridView::CMygridView()
- : CFormView(CMygridView::IDD)
- {
- //{{AFX_DATA_INIT(CMygridView)
- m_grid = NULL;
- m_ForData = "";
- //}}AFX_DATA_INIT
- }
-
- CMygridView::~CMygridView()
- {
- }
-
- void CMygridView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMygridView)
- DDX_VBControl(pDX, IDC_GRID1, m_grid);
- DDX_Text(pDX, IDC_FOR_DATA, m_ForData);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMygridView, CFormView)
- //{{AFX_MSG_MAP(CMygridView)
- ON_VBXEVENT(VBN_CLICK, IDC_GRID1, OnClickGrid1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMygridView message handlers
-
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- void CMygridView::OnInitialUpdate()
- {
-
- // Call the base class function.
- CFormView::OnInitialUpdate();
-
-
- // Set the current row to row 0.
- m_grid->SetNumProperty("Row",0);
- // Set the current col to 1.
- m_grid->SetNumProperty("Col",1);
- // Fill the cell (Row = 0, Col = 1)
- m_grid->SetStrProperty ("Text", "Bob");
-
-
- // Fill the cell (Row = 0, Col = 2)
- m_grid->SetNumProperty("Col",2);
- m_grid->SetStrProperty ("Text", "Bill");
-
- // Fill the cell (Row = 0, Col = 3)
- m_grid->SetNumProperty("Col",3);
- m_grid->SetStrProperty ("Text", "Ruth");
-
- // Fill the cell (Row = 0, Col = 4)
- m_grid->SetNumProperty("Col",4);
- m_grid->SetStrProperty ("Text", "Ben");
-
-
- // Set the current col to 0.
- m_grid->SetNumProperty("Col",0);
-
- // Fill the cell (Row = 1, Col = 0)
- m_grid->SetNumProperty("Row",1);
- m_grid->SetStrProperty ("Text", "Jan");
-
- // Fill the cell (Row = 2, Col = 0)
- m_grid->SetNumProperty("Row",2);
- m_grid->SetStrProperty ("Text", "Feb");
-
- // Fill the cell (Row = 3, Col = 0)
- m_grid->SetNumProperty("Row",3);
- m_grid->SetStrProperty ("Text", "Mar");
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- void CMygridView::OnClickGrid1(UINT, int, CWnd*, LPVOID)
- {
- // TODO: Add your VBX event notification handler code here
-
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Update the m_ForData with Current contents of
- // the edit box.
- UpdateData(TRUE);
-
-
- m_grid->SetStrProperty ("Text", m_ForData);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- }
-