home *** CD-ROM | disk | FTP | other *** search
- // listdlg.cpp : implementation file
- // Copyright (C) 1996 LEAD Technologies, Inc.
- // All rights reserved.
-
- #include "stdafx.h"
- #include "mfcdemo.h"
- #include "listdlg.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CListDlg dialog
-
-
- CListDlg::CListDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CListDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CListDlg)
- m_nValue = 0;
- m_strLabel = _T("");
- m_strTitle = _T("");
- m_strInit = _T("");
- //}}AFX_DATA_INIT
- }
-
-
- void CListDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CListDlg)
- DDX_Control(pDX, IDC_LIST1, m_List);
- DDX_Text(pDX, IDC_STATIC1, m_strLabel);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CListDlg, CDialog)
- //{{AFX_MSG_MAP(CListDlg)
- ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
- ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CListDlg message handlers
-
- BOOL CListDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- SetWindowText(m_strTitle);
- int j = 0;
- for(int i = 0; i < m_strInit.GetLength(); i++)
- {
- if(m_strInit[i] == '|')
- {
- m_List.AddString(m_strInit.Mid(j, i - j));
- j = i + 1;
- }
- }
- m_List.SetCurSel(m_nValue);
- // TODO: Add extra initialization here
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
-
- void CListDlg::OnSelchangeList1()
- {
- m_nValue = m_List.GetCurSel();
-
- }
-
- void CListDlg::OnDblclkList1()
- {
- OnOK();
- }