📄 sdrkbhdlg.cpp
字号:
// sdrkbhdlg.cpp : implementation file
//
#include "stdafx.h"
#include "xxgl.h"
#include "sdrkbhdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Csdrkbhdlg dialog
static int cur_focus;
switch_to_english_mode(CWnd *wnd);
switch_to_chinese_mode(CWnd *wnd);
Set_to_item_end(CWnd *wd,int id);
Csdrkbhdlg::Csdrkbhdlg(CWnd* pParent /*=NULL*/)
: CDialog(Csdrkbhdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(Csdrkbhdlg)
m_jsrkbh = _T("");
m_qsrkbh = _T("");
//}}AFX_DATA_INIT
cur_focus = 0;
}
void Csdrkbhdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Csdrkbhdlg)
DDX_Text(pDX, IDC_jsrkbh, m_jsrkbh);
DDX_Text(pDX, IDC_qsrkbh, m_qsrkbh);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Csdrkbhdlg, CDialog)
//{{AFX_MSG_MAP(Csdrkbhdlg)
ON_EN_CHANGE(IDC_jsrkbh, OnChangejsrkbh)
ON_EN_CHANGE(IDC_qsrkbh, OnChangeqsrkbh)
ON_EN_SETFOCUS(IDC_jsrkbh, OnSetfocusjsrkbh)
ON_EN_SETFOCUS(IDC_qsrkbh, OnSetfocusqsrkbh)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Csdrkbhdlg message handlers
void Csdrkbhdlg::OnChangejsrkbh()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf[20];
GetDlgItemText(IDC_jsrkbh,buf,20);
int l,i;
l = strlen(buf);
if (l > 6){
buf[6] = 0;
SetDlgItemText(IDC_jsrkbh,buf);
Set_to_item_end(this,IDC_jsrkbh);
}
if (l > 0){
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
buf[i] = 0;
SetDlgItemText(IDC_jsrkbh,buf);
Set_to_item_end(this,IDC_jsrkbh);
}
}
}
}
void Csdrkbhdlg::OnChangeqsrkbh()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf[20];
GetDlgItemText(IDC_qsrkbh,buf,20);
int l,i;
l = strlen(buf);
if (l > 6){
buf[6] = 0;
SetDlgItemText(IDC_qsrkbh,buf);
Set_to_item_end(this,IDC_qsrkbh);
}
if (l > 0){
for (i=0;i<l;i++){
if ((buf[i] < '0')||(buf[i] > '9')){
buf[i] = 0;
SetDlgItemText(IDC_qsrkbh,buf);
Set_to_item_end(this,IDC_qsrkbh);
}
}
}
}
void Csdrkbhdlg::OnOK()
{
// TODO: Add extra validation here
char buf[20];
int bt,et;
CWnd *wn_qsrkbh;
CWnd *wn_jsrkbh;
CWnd *wn_ok;
CWnd *wn_cur;
wn_qsrkbh = GetDlgItem(IDC_qsrkbh);
wn_jsrkbh = GetDlgItem(IDC_jsrkbh);
wn_ok = GetDlgItem(IDOK);
wn_cur = GetFocus();
if (wn_cur->m_hWnd != wn_ok->m_hWnd){
if (cur_focus == 1){
wn_jsrkbh->SetFocus();
return ;
}
}
GetDlgItemText(IDC_qsrkbh,buf,20);
if (strlen(buf) > 10){
MessageBox("起始入库编号错误.",MB_OK);
wn_qsrkbh->SetFocus();
return;
}
GetDlgItemText(IDC_jsrkbh,buf,20);
if (strlen(buf) > 10){
MessageBox("结束入库编号错误.",MB_OK);
wn_jsrkbh->SetFocus();
return;
}
GetDlgItemText(IDC_qsrkbh,buf,20);
bt = atoi(buf);
GetDlgItemText(IDC_jsrkbh,buf,20);
et = atoi(buf);
if ((bt > et)&&(bt != 0)&&(et != 0)){
MessageBox("输入的起始编号大于结束编号,请重新输入.","",MB_OK);
wn_qsrkbh->SetFocus();
return;
}
CDialog::OnOK();
}
void Csdrkbhdlg::OnSetfocusjsrkbh()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_jsrkbh);
switch_to_english_mode(wnd);
cur_focus = 2;
}
void Csdrkbhdlg::OnSetfocusqsrkbh()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_qsrkbh);
switch_to_english_mode(wnd);
cur_focus = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -