void CHardwareListingCAN::OnEnKillfocusCanfdEditBaudRate() { OnKillFocusOfEditBox(&m_omCANFDEditBaudRate,m_omCANFDStrEditBaudRate ,1); //Validation on Kill Focus CButton* pomButtonCANFD = (CButton*) GetDlgItem(IDC_CHECK_CANFD); if(pomButtonCANFD != nullptr) { UINT unButton = pomButtonCANFD->GetState(); if(1 != unButton ) { m_chkCANFD.SetCheck(BST_UNCHECKED); m_omCANFDEditBaudRate.EnableWindow(FALSE); } } }
void CdynControlDlg::SendServo(UINT idx) { CButton *check = (CButton*)GetDlgItem(CHECK_ID_OFFSET + idx); if (check->GetState() != BST_CHECKED) return; CSliderCtrl *slider = (CSliderCtrl*)GetDlgItem(SLIDER_ID_OFFSET + idx); int deg = slider->GetPos(); CEdit *view = (CEdit*)GetDlgItem(VIEW_ID_OFFSET + idx); CString str; view->GetWindowText(str); deg = _ttoi(str); log(_T("set servo 0x%02x, deg: %d\n"), idx, deg); deg *= 10; jointAbsolutePosSet(cmd, &cmdLen, idx, °); SendData(cmd, cmdLen); }
void CHardwareListingCAN::OnKillFocusOfEditBox(CEdit* omEditBaudRate, CString omStrEditBaudRate,bool bchkCANFD) { CString omStrBaudRate =""; CString omStrValid =""; INT nLength = 0; omEditBaudRate->GetWindowText(omStrBaudRate); nLength = omStrBaudRate.GetLength(); CButton* pomButtonCancel = (CButton*) GetDlgItem(IDCANCEL); // To get the state of CANCEL button. A non zero value if the button is // clicked. UINT unButtonState; if(nullptr!=pomButtonCancel) { unButtonState = pomButtonCancel->GetState(); } // Validate only if next command is not ESC Button if(m_bDialogCancel != TRUE ) { // Don't validate if CANCEL button is clicked. if(unButtonState ==0 ) { // Validate for empty string and if zero value is entered. DOUBLE dBaudRate = (FLOAT) _tstof(omStrBaudRate); if(bchkCANFD == 0) { ValidationOfKillFocus(omEditBaudRate, omStrEditBaudRate, bchkCANFD,1000000); } else if(bchkCANFD == 1) { ValidationOfKillFocus(omEditBaudRate, omStrEditBaudRate, bchkCANFD,8000000); } } } else { omEditBaudRate->SetWindowText(m_omStrEditBaudRate); } }