Data1Dlg.cpp
资源名称:vc开发gis代码.rar [点击查看]
上传用户:jndfzt02
上传日期:2007-04-25
资源大小:391k
文件大小:2k
源码类别:
GIS编程
开发平台:
Visual C++
- // Data1Dlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "draw.h"
- #include "data1ret.h"
- #include "Data1Dlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CData1Dlg dialog
- CData1Dlg::CData1Dlg(CWnd* pParent /*=NULL*/)
- : CDialog(CData1Dlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CData1Dlg)
- m_pSet = NULL;
- //}}AFX_DATA_INIT
- }
- CData1Dlg::CData1Dlg(CData1Set* pSet,BOOL IsAdd,int id,CWnd* pParent /*=NULL*/)
- : CDialog(CData1Dlg::IDD, pParent)
- {
- m_pSet=pSet;
- b_IsAdd=IsAdd;
- m_id=id;
- }
- void CData1Dlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CData1Dlg)
- DDX_FieldText(pDX, IDC_EDIT1, m_pSet->m_only_id, m_pSet);
- DDX_FieldText(pDX, IDC_EDIT2, m_pSet->m_city_name, m_pSet);
- DDX_FieldText(pDX, IDC_EDIT3, m_pSet->m_population, m_pSet);
- DDX_FieldText(pDX, IDC_EDIT4, m_pSet->m_area, m_pSet);
- DDX_FieldText(pDX, IDC_EDIT5, m_pSet->m_industry, m_pSet);
- DDX_FieldText(pDX, IDC_EDIT6, m_pSet->m_translate, m_pSet);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CData1Dlg, CDialog)
- //{{AFX_MSG_MAP(CData1Dlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CData1Dlg message handlers
- BOOL CData1Dlg::OnInitDialog()
- {
- char p1[7];
- if(b_IsAdd)
- {
- sprintf(p1,"%d",m_id);
- SetDlgItemText(IDC_EDIT1,p1);
- }
- else
- CDialog::OnInitDialog();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CData1Dlg::OnOK()
- {
- // TODO: Add extra validation here
- char p1[7];
- if(b_IsAdd)
- {
- sprintf(p1,"%d",m_id);
- SetDlgItemText(IDC_EDIT1,p1);
- m_pSet->AddNew();
- UpdateData();
- if(m_pSet->CanUpdate())
- m_pSet->Update();
- else
- ; //不能修改数据源
- }
- else
- {
- m_pSet->Edit();
- UpdateData();
- if(m_pSet->CanUpdate())
- m_pSet->Update();
- else
- ; //不能修改数据源
- }
- EndDialog(IDOK);
- }
- void CData1Dlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- CDialog::OnCancel();
- }