home *** CD-ROM | disk | FTP | other *** search
- // insertro.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "mfcdemo.h"
- #include "insertro.h"
- #include "demotbl.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CInsertRowColDialog dialog
-
-
- CInsertRowColDialog::CInsertRowColDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CInsertRowColDialog::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CInsertRowColDialog)
- m_Amount = 0;
- m_Before = 0;
- //}}AFX_DATA_INIT
- }
-
- void CInsertRowColDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CInsertRowColDialog)
- DDX_Text(pDX, IDC_INSERT_AMOUNT, m_Amount);
- DDV_MinMaxInt(pDX, m_Amount, 1, 32767);
- DDX_Text(pDX, IDC_INSERT_BEFORE, m_Before);
- DDV_MinMaxInt(pDX, m_Before, 0, 32767);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CInsertRowColDialog, CDialog)
- //{{AFX_MSG_MAP(CInsertRowColDialog)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CInsertRowColDialog publics
-
- void CInsertRowColDialog::InitializeFrom( CDemoTableControl * aCKTBL )
- {
- cktbl = aCKTBL;
- m_Amount = 1;
- if(rows)
- m_Before = cktbl->GetCurrentRow();
- else
- m_Before = cktbl->GetCurrentColumn();
-
- if(m_Before<1) m_Before=1;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CInsertRowColDialog message handlers
-
- BOOL CInsertRowColDialog::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- char * title;
- char * group;
-
- // TODO: Add extra initialization here
-
- if(rows) {
- title = "CKTBL Insert Rows";
- group = "Insert Rows";
- } else {
- title = "CKTBL Insert Columns";
- group = "Insert Columns";
- }
-
- SetWindowText(title);
- GetDlgItem(IDC_INSERT_GROUP)->SetWindowText(group);
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
-
- void CInsertRowColDialog::OnOK()
- {
- // TODO: Add extra validation here
-
- CDialog::OnOK();
-
- if(rows)
- cktbl->InsertRowsAfter( m_Before-1, m_Amount );
- else
- cktbl->InsertColumnsAfter( m_Before-1, m_Amount );
-
- }
-