root/MainAddressBookAddDlg.cpp

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. CMainAddressBookAddDlg
  2. DoDataExchange
  3. BEGIN_MESSAGE_MAP
  4. OnOK

/*
 * Copyright (C) 2002-2003 chik, s.hiranaka
 * For license terms, see the file COPYING in this directory.
 */

// MainAddressBookAddDlg.cpp : インプリメンテーション ファイル
//

#include "stdafx.h"
#include "pochy.h"
#include "MainAddressBookAddDlg.h"
#include "MainAddressBookDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainAddressBookAddDlg ダイアログ


CMainAddressBookAddDlg::CMainAddressBookAddDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CMainAddressBookAddDlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CMainAddressBookAddDlg)
                // メモ - ClassWizard はこの位置にマッピング用のマクロを追加または削除します。
        //}}AFX_DATA_INIT
}


void CMainAddressBookAddDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CMainAddressBookAddDlg)
        DDX_Control(pDX, IDC_MAIN_ADDRESSBOOK_ADD_OTHERS, m_others);
        DDX_Control(pDX, IDC_MAIN_ADDRESSBOOK_ADD_NAME, m_name);
        DDX_Control(pDX, IDC_MAIN_ADDRESSBOOK_ADD_ADDRESS, m_address);
        //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMainAddressBookAddDlg, CDialog)
        //{{AFX_MSG_MAP(CMainAddressBookAddDlg)
//      ON_BN_CLICKED(IDC_MAIN_ADDRESSBOOK_ADD_ADD, OnAdd)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainAddressBookAddDlg メッセージ ハンドラ

/*void CMainAddressBookAddDlg::OnAdd() 
{
/*      CString address;
        CString name;
        CString others;
        m_address.GetWindowText(address);
        m_name.GetWindowText(name);
        m_others.GetWindowText(others);

        CMainAddressBookDlg *dlg;
        dlg = (CMainAddressBookDlg *)this->GetParent();

        int n = dlg->m_lc.GetItemCount();
        dlg->m_lc.InsertItem(n, name);
        dlg->m_lc.SetItemText(n, 1, address);
        dlg->m_lc.SetItemText(n, 2, others);

        CDialog::OnOK();*/
//}

BOOL CMainAddressBookAddDlg::OnInitDialog() 
{
        CDialog::OnInitDialog();

        m_name.SetFocus();
        // TODO: この位置に初期化の補足処理を追加してください
        
        return FALSE;  // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります
                      // 例外: OCX プロパティ ページの戻り値は FALSE となります
}

void CMainAddressBookAddDlg::OnOK() 
{
        CString address;
        CString name;
        CString others;
        m_address.GetWindowText(address);
        m_name.GetWindowText(name);
        m_others.GetWindowText(others);

        CMainAddressBookDlg *dlg;
        dlg = (CMainAddressBookDlg *)this->GetParent();

        int n = dlg->m_lc.GetItemCount();
        dlg->m_lc.InsertItem(n, name);
        dlg->m_lc.SetItemText(n, 1, address);
        dlg->m_lc.SetItemText(n, 2, others);

        CDialog::OnOK();
}

/* [<][>][^][v][top][bottom][index][help] */