GrammarDlg.cpp
资源名称:ictprop.rar [点击查看]
上传用户:tenhai
上传日期:2021-02-19
资源大小:492k
文件大小:2k
源码类别:
组合框控件
开发平台:
Visual C++
- // GrammarDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include <afxdlgs.h>
- #include "prop.h"
- #include "GrammarDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CGrammarDlg dialog
- CGrammarDlg::CGrammarDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CGrammarDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CGrammarDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CGrammarDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CGrammarDlg)
- DDX_Control(pDX, IDC_GRAMMARLST, m_glist);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CGrammarDlg, CDialog)
- //{{AFX_MSG_MAP(CGrammarDlg)
- ON_BN_CLICKED(IDLOAD, OnLoad)
- ON_LBN_DBLCLK(IDC_GRAMMARLST, OnDblclkGrammarlst)
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CGrammarDlg message handlers
- void CGrammarDlg::OnLoad()
- {
- // TODO: Add your control notification handler code here
- CFileDialog fdlg(TRUE);
- fdlg.DoModal();
- CString loaded;
- loaded=fdlg.GetPathName();
- m_curg=loaded;
- int nIndex=m_glist.AddString(LPCTSTR(loaded));
- m_glist.SetSel(nIndex, TRUE);
- }
- void CGrammarDlg::OnDblclkGrammarlst()
- {
- // TODO: Add your control notification handler code here
- int nIndex=m_glist.GetCurSel();
- m_glist.GetText(nIndex, m_curg);
- OnOK();
- }
- void CGrammarDlg::OnOK()
- {
- CDialog::OnOK();
- }
- BOOL CGrammarDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- int i, n=m_gcache.GetCount();
- for (i=0; i<n; i++){
- CString str=m_gcache.RemoveHead();
- m_glist.AddString(str);
- }
- //m_glist=m_gcache;
- // 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 CGrammarDlg::OnDestroy()
- {
- //m_gcahe=m_glist;
- int i, n=m_glist.GetCount();
- CString str;
- for (i=0; i<n; i++)
- {
- m_glist.GetText(i, str);
- m_gcache.AddTail(LPCTSTR(str));
- }
- CDialog::OnDestroy();
- // TODO: Add your message handler code here
- }