📄 inputcombobox.cpp
字号:
// InputComboBox.cpp : implementation file
//
#include "stdafx.h"
#include "prop.h"
#include "InputComboBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInputComboBox
CInputComboBox::CInputComboBox()
{
}
CInputComboBox::~CInputComboBox()
{
}
BEGIN_MESSAGE_MAP(CInputComboBox, CComboBox)
//{{AFX_MSG_MAP(CInputComboBox)
ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelchange)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInputComboBox message handlers
void CInputComboBox::OnSelchange()
{
// TODO: Add your control notification handler code here
int nIndex = GetCurSel();
GetLBText(nIndex, m_strInput);
// InvokeAction();
}
BOOL CInputComboBox::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) {
OnCmd(0);
}
return CComboBox::PreTranslateMessage(pMsg);
}
void CInputComboBox::InvokeAction(int type)
{
extern CPropApp theApp;
CString strTmp1 = "build F:/其他书籍/概率句法分析器/prop/propexec/pcfg-上下文无关.txt";
CString strTmp2 = "build F:/其他书籍/概率句法分析器/prop/propexec/prcfg-结构上下文相关.txt";
CString strTmp3 = "parse F:/其他书籍/概率句法分析器/prop/propexec/test-测试例句.txt";
if( 0 == type )
{
m_strInput = strTmp1;
}
if( 1 == type )
{
m_strInput = strTmp2;
}
if( 2 == type )
{
m_strInput = strTmp3;
}
theApp.ExecCmd(m_strInput);
}
void CInputComboBox::UpdateInput()
{
int nIndex=AddUniqueString(m_strInput);
SetCurSel(nIndex);
}
void CInputComboBox::OnCmd(int type)
{
//GetWindowText(m_strInput);
//AddUniqueString(m_strInput);
InvokeAction(type);
}
int CInputComboBox::AddUniqueString(CString str)
{
int nIndex=0;
int nCount=GetCount();
nIndex=FindStringExact(nIndex, LPCSTR(str));
if (nIndex!=LB_ERR)
return nIndex;
else
return InsertString(0, (LPCSTR)str);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -