BOOL CDlgStrategyHQ::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_KEYDOWN) { if(pMsg->wParam == VK_RETURN ) { UINT nID = GetFocus()->GetDlgCtrlID(); switch( nID) { case IDC_EDITGAP: { CWnd* pwnd = GetParent(); if (pwnd && pwnd->IsKindOf(RUNTIME_CLASS(CDlgStrategyMain))) { CDlgStrategyMain *pMain = (CDlgStrategyMain*)pwnd; pMain->OnBnClickedOk(); } break; } default: NextDlgCtrl(); } return TRUE; } else if (pMsg->wParam == VK_TAB) { NextDlgCtrl(); return TRUE; } } return FALSE; }
bool CDlg::OnOverEdit(int IdBeg, int IdEnd) { CString strItem,strMsg,strCount; int count=0; int Id; strMsg.LoadString(IDS_STRING9016); GotoDlgCtrl(GetDlgItem(IdBeg)); do{ Id = GetFocus()->GetDlgCtrlID(); switch(Id){ case IDC_EDIT1: GetDlgItem(IDC_EDIT1)->GetWindowTextW(m_Edit1); m_Edit1.Replace(',','.'); m_Edit1.TrimRight(); m_Edit1.TrimLeft(); if(m_Edit1==' ') m_Edit1.Empty(); if(m_Edit1.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT1)->GetWindowText(strItem); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; } NextDlgCtrl(); } while (Id!=IdEnd); if(count!=0) AfxMessageBox(strMsg,MB_ICONINFORMATION); return count==0 ? true:false; }
bool CDlg::OnOverEdit(int IdBeg, int IdEnd) { CString strItem,strMsg,strCount; int count=0; int Id; // strMsg = _T("Вы забыли заполнить следующие поля :\n\t"); strMsg.LoadString(IDS_STRING9016); GotoDlgCtrl(GetDlgItem(IdBeg)); do{ Id = GetFocus()->GetDlgCtrlID(); switch(Id){ case IDC_EDIT1: if(m_Edit1.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT1)->GetWindowText(strItem); strCount.Format(L"%i",count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; } NextDlgCtrl(); } while (Id!=IdEnd); if(count!=0) AfxMessageBox(strMsg,MB_ICONINFORMATION); return count==0 ? true:false; }
BOOL CDlgLevelInput::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_KEYDOWN) { if(pMsg->wParam == VK_TAB) { UINT nID = GetFocus()->GetDlgCtrlID(); switch(nID) { case IDC_EDIT_SHPWD: this->GetParent()->GetDlgItem(IDC_BUTTON_LOGIN)->SetFocus(); break; default: NextDlgCtrl(); } return TRUE; } else if (pMsg->wParam == VK_RETURN) { UINT nID = GetFocus()->GetDlgCtrlID(); switch(nID) { case IDC_EDIT_SHPWD: { CWnd* pWnd = GetParent()->GetDlgItem(IDC_BUTTON_LOGIN); if (pWnd) { pWnd->SetFocus(); ::PostMessage(GetParent()->m_hWnd, WM_KEYDOWN, VK_RETURN, 1); } break; } default: NextDlgCtrl(); } return TRUE; } else if (pMsg->wParam == VK_ESCAPE) { ::PostMessage(GetParent()->m_hWnd, WM_KEYDOWN, VK_ESCAPE, 1); return TRUE; } } return CDialogEx::PreTranslateMessage(pMsg); }
void CClientSocketDlg::OnBtnConnect() { UpdateData(); CString strServer; m_ctlIPAddress.GetWindowText( strServer ); bool bSuccess; if (m_nSockType == SOCK_TCP) { bSuccess = m_SocketManager.ConnectTo( strServer, m_strPort, AF_INET, SOCK_STREAM); // TCP } else { bSuccess = m_SocketManager.ConnectTo( strServer, m_strPort, AF_INET, SOCK_DGRAM); // UDP } if (bSuccess && m_SocketManager.WatchComm()) { GetDlgItem(IDC_BTN_SEND)->EnableWindow( TRUE ); GetDlgItem(IDC_BTN_STOP)->EnableWindow( TRUE ); NextDlgCtrl(); GetDlgItem(IDC_BTN_START)->EnableWindow( FALSE ); GetDlgItem(IDC_TCP)->EnableWindow( FALSE ); GetDlgItem(IDC_UDP)->EnableWindow( FALSE ); CString strMsg; if (m_nSockType == SOCK_TCP) { strMsg = _T("Connection established with server: ") + strServer; strMsg += _T(" on port ") + m_strPort + CString("\r\n"); m_SocketManager.GetPeerName( m_SockPeer ); } else { SockAddrIn addrin; m_SocketManager.GetSockName( addrin ); // just to get our current address LONG uAddr = addrin.GetIPAddr(); BYTE* sAddr = (BYTE*) &uAddr; int nPort = ntohs( addrin.GetPort() ); CString strAddr; // Address is stored in network format... strAddr.Format(_T("IP: %u.%u.%u.%u, Port: %d"), (UINT)(sAddr[0]), (UINT)(sAddr[1]), (UINT)(sAddr[2]), (UINT)(sAddr[3]), nPort); strMsg = _T("Socket created: ") + strAddr + CString("\r\n"); m_SockPeer.CreateFrom( strServer, m_strPort, AF_INET); } m_ctlMsgList.SetWindowText( strMsg ); } }
LRESULT CRegisterDeviceDialog:: OnDeviceIdChange(UINT uCode, int nCtrlID, HWND hwndCtrl) { CEdit wndCurrentEdit(hwndCtrl); BOOL bEnableRegister(FALSE); BOOL bNextDlgCtrl(FALSE); if (m_wndStringIDs[0].GetWindowTextLength() == 5 && m_wndStringIDs[1].GetWindowTextLength() == 5 && m_wndStringIDs[2].GetWindowTextLength() == 5 && m_wndStringIDs[3].GetWindowTextLength() == 5 && (m_wndStringKey.GetWindowTextLength() == 0 || m_wndStringKey.GetWindowTextLength() == 5)) { BOOL bValid = IsValidDeviceStringIdKey(); if (!bValid) { EDITBALLOONTIP tip; tip.cbStruct = sizeof(tip); tip.pszText = TEXT("Device ID is composed of alphabet characters and numbers only!\nIt's 20 characters.\n"); tip.pszTitle = TEXT("Invalid device ID?"); tip.ttiIcon = TTI_WARNING; wndCurrentEdit.ShowBalloonTip(&tip); bEnableRegister = FALSE; bNextDlgCtrl = FALSE; } else { bEnableRegister = TRUE; bNextDlgCtrl = TRUE; } } else { if (wndCurrentEdit.GetWindowTextLength() >= 5) { bNextDlgCtrl = TRUE; } } m_wndRegister.EnableWindow(bEnableRegister); if (bNextDlgCtrl) NextDlgCtrl(); return 0; }
void CPrintSize::OnSetfocusSecret2() { BOOL bForward = (m_active_item_id == 0); if (ChangeFocus(0)) { if (bForward) { NextDlgCtrl(); } else { PrevDlgCtrl(); } } }
void CAcceptanceFilterDlg::OnMaxtextEditAcceptanceMask3() { NextDlgCtrl(); }
void CAcceptanceFilterDlg::OnMaxtextEditAcceptanceCode4() { NextDlgCtrl(); }
bool CDlg::OnOverEdit(int IdBeg, int IdEnd) { CString strItem,strMsg,strCount,strC; int count=0; int Id; strMsg.LoadString(IDS_STRING9016); GotoDlgCtrl(GetDlgItem(IdBeg)); do{ Id = GetFocus()->GetDlgCtrlID(); switch(Id){ case IDC_EDIT1: GetDlgItem(IDC_EDIT1)->GetWindowTextW(m_Edit1); m_Edit1.TrimRight(' '); m_Edit1.TrimLeft(' '); if(m_Edit1==' ') m_Edit1.Empty(); if(m_Edit1.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT1)->GetWindowText(strItem); strCount.Format(L"%i",count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT2: GetDlgItem(IDC_EDIT2)->GetWindowTextW(m_Edit2); m_Edit2.TrimRight(' '); m_Edit2.TrimLeft(' '); if(m_Edit2==' ') m_Edit2.Empty(); if(m_Edit2.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT2)->GetWindowText(strItem); strCount.Format(L"%i",count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT3: GetDlgItem(IDC_EDIT3)->GetWindowTextW(m_Edit3); m_Edit3.TrimRight(' '); m_Edit3.TrimLeft(' '); if(m_Edit3==' ') m_Edit3.Empty(); if(m_Edit3.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT3)->GetWindowText(strItem); strCount.Format(L"%i",count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT4: GetDlgItem(IDC_EDIT4)->GetWindowTextW(m_Edit4); m_Edit4.TrimRight(' '); m_Edit4.TrimLeft(' '); if(m_Edit4==' ') m_Edit4.Empty(); if(m_Edit4.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT4)->GetWindowText(strItem); strCount.Format(L"%i",count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT5: GetDlgItem(IDC_EDIT5)->GetWindowTextW(m_Edit5); m_Edit5.TrimRight(' '); m_Edit5.TrimLeft(' '); if(m_Edit5==' ') m_Edit5.Empty(); if(m_Edit5.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_EDIT5)->GetWindowText(strItem); strCount.Format(L"%i",count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT6: GetDlgItem(IDC_EDIT6)->GetWindowTextW(m_Edit6); m_Edit6.TrimRight(' '); m_Edit6.TrimLeft(' '); m_Edit6.Replace(',','.'); if(m_Edit6==' ') m_Edit6.Empty(); if(m_Edit6.IsEmpty() || m_Edit6=='.'){ count++; GetDlgItem(IDC_STATIC_EDIT6)->GetWindowText(strItem); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT7: GetDlgItem(IDC_EDIT7)->GetWindowTextW(m_Edit7); m_Edit7.TrimRight(' '); m_Edit7.TrimLeft(' '); m_Edit7.Replace(',','.'); if(m_Edit7==' ') m_Edit7.Empty(); if(m_Edit7.IsEmpty() || m_Edit7=='.'){ count++; GetDlgItem(IDC_STATIC_EDIT7)->GetWindowText(strItem); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; case IDC_EDIT8: GetDlgItem(IDC_EDIT8)->GetWindowTextW(m_Edit8); m_Edit8.TrimRight(' '); m_Edit8.TrimLeft(' '); m_Edit8.Replace(',','.'); if(m_Edit8==' ') m_Edit8.Empty(); if(m_Edit8.IsEmpty() || m_Edit8=='.'){ count++; GetDlgItem(IDC_STATIC_EDIT8)->GetWindowText(strItem); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } break; } NextDlgCtrl(); } while (Id!=IdEnd); //Раздел COMBO strC = m_DataCombo1.get_BoundText(); strC.TrimRight(' '); strC.TrimLeft(' '); if(strC==' ') strC.Empty(); if(strC.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_COMBO1)->GetWindowText(strItem); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } strC = m_DataCombo2.get_BoundText(); strC.TrimRight(' '); strC.TrimLeft(' '); if(strC==' ') strC.Empty(); if(strC.IsEmpty()){ count++; GetDlgItem(IDC_STATIC_COMBO2)->GetWindowText(strItem); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } //Раздел Grid if(!IsEnableRec(ptrRs2)){ //Страна count++; strItem.LoadStringW(IDS_STRING9031); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } if(!IsEnableRec(ptrRs3)){ //Классификатор count++; strItem.LoadStringW(IDS_STRING9030); strCount.Format(_T("%i"),count); strCount+=_T(") "); strMsg+=strCount+strItem+_T("\n\t"); } if(count!=0) AfxMessageBox(strMsg,MB_ICONINFORMATION); return count==0 ? true:false; }