| | |
| | | ON_BN_CLICKED(IDC_BUTTON_DISCONN, &CDialogFactCfg::OnBnClickedButtonDisconn)
|
| | | ON_BN_CLICKED(IDC_BUTTON_READDATA, &CDialogFactCfg::OnBnClickedButtonReaddata)
|
| | | ON_BN_CLICKED(IDC_BUTTON_WRITEDATA, &CDialogFactCfg::OnBnClickedButtonWritedata)
|
| | |
|
| | | ON_BN_CLICKED(IDC_BUTTON1, &CDialogFactCfg::OnBnClickedBtn1)
|
| | | ON_BN_CLICKED(IDC_BUTTON3, &CDialogFactCfg::OnBnClickedBtn3)
|
| | | ON_BN_CLICKED(IDC_BUTTON4, &CDialogFactCfg::OnBnClickedBtn4)
|
| | | ON_BN_CLICKED(IDC_BUTTON5, &CDialogFactCfg::OnBnClickedBtn5)
|
| | | ON_BN_CLICKED(IDC_BUTTON_CLEAR, &CDialogFactCfg::OnBnClickedBtnClear)
|
| | | ON_BN_CLICKED(IDC_BUTTON_ADD, &CDialogFactCfg::OnBnClickedBtnAdd)
|
| | | ON_BN_CLICKED(IDC_BUTTON_BACKSPACE, &CDialogFactCfg::OnBnClickedBtnBackSpace)
|
| | |
|
| | |
|
| | | ON_BN_CLICKED(IDC_BUTTON_0, &CDialogFactCfg::OnBnClickedButton0)
|
| | | ON_BN_CLICKED(IDC_BUTTON1_DOT, &CDialogFactCfg::OnBnClickedButton1Dot)
|
| | | ON_BN_CLICKED(IDC_BUTTON_EQ, &CDialogFactCfg::OnBnClickedButtonEq)
|
| | | END_MESSAGE_MAP()
|
| | |
|
| | | // CDialogFactCfg 消息处理程序
|
| | |
| | |
|
| | | }
|
| | |
|
| | | CString saveInputStr=_T(""), saveInput1Str= _T("");
|
| | | CString sDisplayStr;
|
| | | CString sStoreStr;
|
| | | bool bEditEndFlg = false;
|
| | |
|
| | | int CDialogFactCfg::CharKeyClick(CString sKey)
|
| | | {
|
| | | // TODO: 在此处添加实现代码.
|
| | | if (bEditEndFlg)
|
| | | {
|
| | | sDisplayStr.Empty();
|
| | | bEditEndFlg = false;
|
| | | }
|
| | | sDisplayStr.Append(sKey);
|
| | | int len1 = sDisplayStr.GetLength();
|
| | | if (len1 > 1 && sDisplayStr[0] == _T('0')) sDisplayStr = sDisplayStr.Right(sDisplayStr.GetLength() - 1);
|
| | |
|
| | | SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr);
|
| | | return 0;
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtn1()
|
| | | {
|
| | | CharKeyClick(_T("1"));
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtn3()
|
| | | {
|
| | | CharKeyClick(_T("3"));
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtn4()
|
| | | {
|
| | | CharKeyClick(_T("4"));
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtn5() |
| | | {
|
| | | CharKeyClick(_T("5"));
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtnClear()
|
| | | {
|
| | | sDisplayStr.Empty();
|
| | | bEditEndFlg = false;
|
| | | SetDlgItemText(IDC_EDIT_VIEW, _T("0"));
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtnAdd() |
| | | {
|
| | | bEditEndFlg = true;
|
| | | sStoreStr = sDisplayStr;
|
| | |
|
| | | //saveInput1Str = saveInputStr;
|
| | | //saveInputStr = "";
|
| | | }
|
| | | void CDialogFactCfg::OnBnClickedBtnBackSpace()
|
| | | {
|
| | | int len1 = sDisplayStr.GetLength();
|
| | | if (len1 > 1)
|
| | | {
|
| | | sDisplayStr = sDisplayStr.Left(sDisplayStr.GetLength() - 1);
|
| | | }
|
| | | else if (len1 == 1)
|
| | | {
|
| | | sDisplayStr = "0";
|
| | | }
|
| | | // bEditEndFlg = false;
|
| | | SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | void CDialogFactCfg::OnBnClickedButton0()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | CharKeyClick(_T("0"));
|
| | | }
|
| | |
|
| | |
|
| | | void CDialogFactCfg::OnBnClickedButton1Dot()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | CharKeyClick(_T("."));
|
| | | }
|
| | |
|
| | |
|
| | | void CDialogFactCfg::OnBnClickedButtonEq()
|
| | | {
|
| | | // TODO: 在此添加控件通知处理程序代码
|
| | | bEditEndFlg = true;
|
| | |
|
| | | float a = _tstof(sStoreStr);
|
| | | float b = _tstof(sDisplayStr);
|
| | |
|
| | | float c = a + b;
|
| | |
|
| | | sDisplayStr.Format(_T("%g"),c);
|
| | | SetDlgItemText(IDC_EDIT_VIEW, sDisplayStr);
|
| | |
|
| | | }
|