📄 modeteachsel.cpp
字号:
// ModeTeachSel.cpp : implementation file
//
#include "stdafx.h"
#include "alfa.h"
#include "ModeTeachSel.h"
#include "Main.h"
#include "mode.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CModeTeachSel dialog
CModeTeachSel::CModeTeachSel(CWnd* pParent)
: CDialog(CModeTeachSel::IDD, pParent)
{
//{{AFX_DATA_INIT(CModeTeachSel)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CModeTeachSel::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CModeTeachSel)
DDX_Control(pDX, IDC_LIST1, m_list);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CModeTeachSel, CDialog)
//{{AFX_MSG_MAP(CModeTeachSel)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_WM_SHOWWINDOW()
ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CModeTeachSel message handlers
void CModeTeachSel::OnRadio2()
{
// TODO: Add your control notification handler code here
int j=m_list.GetCount();
for(int i=0;i<j;i++)
m_list.DeleteString(0);
CMain * main=(CMain *)GetParent();
POSITION pos;
CString key;
CString m_type="teach";
Cteach * pteach=NULL;
pos=main->dlgmodeteach->m_Contact.GetStartPosition();
while(pos)
{
main->dlgmodeteach->m_Contact.GetNextAssoc(pos,key,pteach);
m_list.AddString(key);
main->m_mode.SetAt(key,m_type);
}
m_list.ShowWindow(TRUE);
GetDlgItem(IDC_BUTTON4)->ShowWindow(TRUE);
}
BOOL CModeTeachSel::OnInitDialog()
{
CDialog::OnInitDialog();
h_SkinDialog.SubClassDialog(m_hWnd);
// TODO: Add extra initialization here
((CButton * )GetDlgItem(IDC_RADIO1))->SetCheck(1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CModeTeachSel::OnRadio1()
{
// TODO: Add your control notification handler code here
m_list.ShowWindow(FALSE);
GetDlgItem(IDC_BUTTON4)->ShowWindow(FALSE);
}
void CModeTeachSel::OnButton2()
{
// TODO: Add your control notification handler code here
if(((CButton *)GetDlgItem(IDC_RADIO2))->GetCheck())
{
if(m_list.GetCurSel()<0)
{
AfxMessageBox("叫匡拒家ㄣ絪腹 !");
return;
}
else
m_list.GetText(m_list.GetCurSel(),m_num);
}
else
m_num="";
CMain * main=(CMain *)GetParent();
ShowWindow(FALSE);
main->dlgmodeteach->ShowWindow(TRUE);
}
void CModeTeachSel::OnButton3()
{
// TODO: Add your control notification handler code here
CMain * main=(CMain *)GetParent();
ShowWindow(FALSE);
main->dlgmodeselect->ShowWindow(TRUE);
}
void CModeTeachSel::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
if(bShow==1)
{
CMain * main=(CMain *)GetParent();
main->dlgcur=this;
if(((CButton *)GetDlgItem(IDC_RADIO2))->GetCheck())
{
OnRadio2();
if(m_list.GetCurSel()<0)
GetDlgItem(IDC_BUTTON4)->EnableWindow(FALSE);
}
}
}
void CModeTeachSel::OnSelchangeList1()
{
// TODO: Add your control notification handler code here
if(m_list.GetCurSel()>=0)
{
GetDlgItem(IDC_BUTTON4)->EnableWindow(TRUE);
}
}
void CModeTeachSel::OnButton4()
{
// TODO: Add your control notification handler code here
CMain * main=(CMain *)GetParent();
CString key;
m_list.GetText(m_list.GetCurSel(),key);
main->dlgmodeteach->m_Contact.RemoveKey(key);
main->dlgmodeteach->SaveRecords();
main->m_mode.RemoveKey(key);
m_list.DeleteString(m_list.GetCurSel());
GetDlgItem(IDC_BUTTON4)->EnableWindow(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -