// TwoPaneForm.cpp : implementation file // #include "stdafx.h" #include "twoPane.h" #include "TwoPaneForm.h" #include "MainFrm.h" #include "TwoPaneList.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CTwoPaneForm IMPLEMENT_DYNCREATE(CTwoPaneForm, CFormView) CTwoPaneForm::CTwoPaneForm() : CFormView(IDD_DIALOG1) { //{{AFX_DATA_INIT(CTwoPaneForm) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } CTwoPaneForm::~CTwoPaneForm() { } void CTwoPaneForm::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTwoPaneForm) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CTwoPaneForm, CFormView) //{{AFX_MSG_MAP(CTwoPaneForm) ON_BN_CLICKED(IDOK, OnOK) ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTwoPaneForm diagnostics #ifdef _DEBUG void CTwoPaneForm::AssertValid() const { CFormView::AssertValid(); } void CTwoPaneForm::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CTwoPaneForm message handlers void CTwoPaneForm::OnOK() { CString Text; GetDlgItemText(IDC_EDIT1,Text); CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1); pEdit->SetFocus(); pEdit->SetSel(0,-1); CMainFrame *pMF = (CMainFrame*)AfxGetMainWnd(); CListCtrl &List = pMF->pListView->GetListCtrl(); List.InsertItem(0,Text); } void CTwoPaneForm::OnChangeEdit1() { CString Text; GetDlgItemText(IDC_EDIT1,Text); } void CTwoPaneForm::OnInitialUpdate() { CFormView::OnInitialUpdate(); SetDlgItemText(IDC_EDIT1,"default text"); CEdit *pEdit = (CEdit*)GetDlgItem(IDC_EDIT1); pEdit->SetFocus(); pEdit->SetSel(0,-1); }