//初始化列表框 static int InitCobList(HWND hDlg) { char strMenu[100]; memset(strMenu, 0, sizeof strMenu); GetStringFromResFile(gsLanguageRes, "GENERAL", "off", strMenu, sizeof strMenu); SendMessage(cobAlmClass, CB_ADDSTRING, 0, (LPARAM)strMenu); memset(strMenu, 0, sizeof strMenu); GetStringFromResFile(gsLanguageRes, "GENERAL", "low", strMenu, sizeof strMenu); SendMessage(cobAlmClass, CB_ADDSTRING, 0, (LPARAM)strMenu); memset(strMenu, 0, sizeof strMenu); GetStringFromResFile(gsLanguageRes, "GENERAL", "middle", strMenu, sizeof strMenu); SendMessage(cobAlmClass, CB_ADDSTRING, 0, (LPARAM)strMenu); memset(strMenu, 0, sizeof strMenu); GetStringFromResFile(gsLanguageRes, "GENERAL", "high", strMenu, sizeof strMenu); SendMessage(cobAlmClass, CB_ADDSTRING, 0, (LPARAM)strMenu); SendMessage(cobAlmClass, CB_SETCURSEL, gCfgCO2.bAlmControl, 0); memset(strMenu, 0, sizeof strMenu); GetStringFromResFile(gsLanguageRes, "GENERAL", "off", strMenu, sizeof strMenu); SendMessage(cobAlmPrint, CB_ADDSTRING, 0, (LPARAM)strMenu); memset(strMenu, 0, sizeof strMenu); GetStringFromResFile(gsLanguageRes, "GENERAL", "on", strMenu, sizeof strMenu); SendMessage(cobAlmPrint, CB_ADDSTRING, 0, (LPARAM)strMenu); SendMessage(cobAlmPrint, CB_SETCURSEL, gCfgCO2.bPrnControl, 0); SetLimitText(gCfgCO2.bUnit, editHigh_EtCO2, gCfgCO2.wHigh_EtCO2, 0); SetLimitText(gCfgCO2.bUnit, editLow_EtCO2, gCfgCO2.wLow_EtCO2, 0); SetLimitText(gCfgCO2.bUnit, editHigh_FiCO2, gCfgCO2.wHigh_FiCO2, 0); return 0; }
void CBSEdit::SetDataLen(UINT nMinDataLen, UINT nMaxDataLen) { UINT nBytes; nBytes = (nMinDataLen > nMaxDataLen) ? nMinDataLen : nMaxDataLen; if (m_iEditMode == (EDIT_MODE_HEX | EDIT_MODE_STR)) SetLimitText(nBytes*3 - 1); else SetLimitText(nBytes); }
void CEditLogB::Update () { //LOCK_BLOCK (_lock); if (!_init) { SetLimitText(_maxLine*1024); _init = true; } int lineCount = GetLineCount (); if (_maxLine < lineCount) { LockWindowUpdate(); SetSel (0, LineIndex (lineCount - _maxLine*8/10)); ReplaceSel (""); _textLength = GetWindowTextLength(); LineScroll(_maxLine, 0); UnlockWindowUpdate(); } for (int i=0, n=_logList.size (); i<n; ++i) { string &smsg = _logList[i]; SetSel (_textLength, _textLength); ReplaceSel (smsg.c_str ()); _textLength += smsg.length (); } _logList.clear (); }
/*************************************************** OnKillFocus Restores the controls max. text length Params: See CWnd::OnKillFocus Return See CWnd::OnKillFocus ****************************************************/ void CUGMaskedEdit::OnKillFocus(CWnd* pNewWnd) { CEdit::OnKillFocus(pNewWnd); // the mask edit control sets max str length // this will cause a problem when some of the cells // do not use a mask (last length will still be set) SetLimitText((ULONG) -1 ); }
//初始化Edit static int InitEditText(HWND hDlg) { //获得报警限值 iTmpTime = gCfgPrinter.iDuration; iTmpInter = gCfgPrinter.iInter; SetLimitText(editDuration, gCfgPrinter.iDuration, 0); // SetLimitText(editAuto, gCfgPrinter.iInter, 1); return 0; }
void CGuiEdit::SetMask(CString mszMask,CString mszShowMask,Mask enTypeMask) { m_szMask=mszMask; m_szShowMask=mszShowMask; m_enMask=enTypeMask; m_cadResult=mszShowMask; SetWindowText(m_szShowMask); SetLimitText( m_szMask.GetLength()+1); int nNext = GetNextPos(0); SetSel(nNext, nNext); }
void CChatEdit::sendChat() { if ( GetLimitText() != 486 ) SetLimitText( 486 ); CString sendText; GetWindowText( sendText ); if ( sendText.GetLength() > 486 ) { MessageBox( "Can not send message: Line too long..." ); return; } ((CChatWindow *)GetParent())->sendChat( sendText ); SetWindowText( "" ); SetFocus(); }
zSHORT ZMLE::LimitTextLength( zULONG ulTextLth ) { #ifdef DEBUG_ALL TraceLineS( "ZMLE::LimitTextLength: ", *m_pzsTag ); #endif if ( ulTextLth >= 0 ) { m_ulLth = ulTextLth; if ( mIs_hWnd( m_hWnd ) ) SetLimitText( m_ulLth ); #ifdef zREMOTE_SERVER zCHAR szTextLth[ 32 ]; zltoa( ulTextLth, szTextLth ); SetRemoteZCtrlAttribute( this, "MLE", "TextLth", szTextLth ); #endif return( 0 ); } return( 1 ); }
/* 编辑框回调函数 */ static int EditProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { int temp; int iVaue; int id; RECT rc; HDC hdc= (HDC)NULL; GetWindowRect(hWnd, &rc); switch(message){ case MSG_SETFOCUS:{ hdc = GetClientDC(GetParent(hWnd)); if(hdc != (HDC)NULL){ SetPenColor(hdc, SETFOCUS_COLOR); Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1); Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2); ReleaseDC(hdc); } }break; case MSG_KILLFOCUS:{ hdc = GetClientDC(GetParent(hWnd)); if(hdc !=(HDC)NULL){ SetPenColor(hdc, KILLFOCUS_COLOR); Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1); Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2); ReleaseDC(hdc); } }break; case MSG_KEYUP:{ id = GetDlgCtrlID(hWnd); switch(wParam){ case SCANCODE_CURSORBLOCKDOWN:{ switch(id){ case DID_CO2SET_HIGH_ETCO2:{ if(iTmpHigh_EtCO2 <CO2_LIMIT_MAX){ iTmpHigh_EtCO2 += CO2_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_EtCO2, 0); } }break; case DID_CO2SET_LOW_ETCO2:{ if(iTmpLow_EtCO2 < (iTmpHigh_EtCO2 - CO2_LIMITRANGE_MIN)){ iTmpLow_EtCO2 += CO2_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_EtCO2, 0); } }break; case DID_CO2SET_HIGH_FICO2:{ if(iTmpHigh_FiCO2 < CO2_LIMIT_MAX){ iTmpHigh_FiCO2 += CO2_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_FiCO2, 0); } }break; case DID_CO2SET_HIGH_RR:{ if(iTmpHigh_RR <RR_LIMIT_MAX){ iTmpHigh_RR += RR_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_RR, 1); } }break; case DID_CO2SET_LOW_RR:{ if(iTmpLow_RR < (iTmpHigh_RR - RR_LIMITRANGE_MIN)){ iTmpLow_RR += RR_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_RR, 1); } }break; case DID_CO2SET_APNEA:{ if(iTmpApnea <APNEA_LIMIT_MAX){ iTmpApnea += APNEA_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpApnea, 2); } }break; } }break; case SCANCODE_CURSORBLOCKUP:{ switch(id){ case DID_CO2SET_HIGH_ETCO2:{ if(iTmpHigh_EtCO2 > (iTmpLow_EtCO2 + CO2_LIMITRANGE_MIN)){ iTmpHigh_EtCO2 -= CO2_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_EtCO2, 0); } }break; case DID_CO2SET_LOW_ETCO2:{ if(iTmpLow_EtCO2 > CO2_LIMIT_MIN){ iTmpLow_EtCO2 -= CO2_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_EtCO2, 0); } }break; case DID_CO2SET_HIGH_FICO2:{ if(iTmpHigh_FiCO2 > CO2_LIMIT_MIN){ iTmpHigh_FiCO2 -= CO2_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_FiCO2, 0); } }break; case DID_CO2SET_HIGH_RR:{ if(iTmpHigh_RR > (iTmpLow_RR + RR_LIMITRANGE_MIN)){ iTmpHigh_RR -= RR_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpHigh_RR, 1); } }break; case DID_CO2SET_LOW_RR:{ if(iTmpLow_RR >RR_LIMIT_MIN){ iTmpLow_RR -= RR_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpLow_RR, 1); } }break; case DID_CO2SET_APNEA:{ if(iTmpApnea > APNEA_LIMIT_MIN){ iTmpApnea -= APNEA_LIMIT_INTER; SetLimitText(gCfgCO2.bUnit, hWnd, iTmpApnea, 2); } }break; } }break; case SCANCODE_ENTER:{ switch(id){ case DID_CO2SET_HIGH_ETCO2:{ gCfgCO2.wHigh_EtCO2= iTmpHigh_EtCO2; SetIntValueToResFile(gFileSetup, "CO2Setup", "etco2_high", gCfgCO2.wHigh_EtCO2, 4); SetFocus(btnSetHigh_EtCO2); }break; case DID_CO2SET_LOW_ETCO2:{ gCfgCO2.wLow_EtCO2 = iTmpLow_EtCO2; SetIntValueToResFile(gFileSetup, "CO2Setup", "etco2_low", gCfgCO2.wLow_EtCO2, 4); SetFocus(btnSetLow_EtCO2); }break; case DID_CO2SET_HIGH_FICO2:{ gCfgCO2.wHigh_FiCO2 = iTmpHigh_FiCO2; SetIntValueToResFile(gFileSetup, "CO2Setup", "fico2_high", gCfgCO2.wHigh_FiCO2, 4); SetFocus(btnSetHigh_FiCO2); }break; case DID_CO2SET_HIGH_RR:{ gCfgCO2.wHigh_awRR = iTmpHigh_RR; SetIntValueToResFile(gFileSetup, "CO2Setup", "awrr_high", gCfgCO2.wHigh_awRR, 4); SetFocus(btnSetHigh_RR); }break; case DID_CO2SET_LOW_RR:{ gCfgCO2.wLow_awRR = iTmpLow_RR; SetIntValueToResFile(gFileSetup, "CO2Setup", "awrr_low", gCfgCO2.wLow_awRR, 4); SetFocus(btnSetLow_RR); }break; case DID_CO2SET_APNEA:{ gCfgCO2.wApneaTime = iTmpApnea; SetIntValueToResFile(gFileSetup, "CO2Setup", "apnea_time", gCfgCO2.wApneaTime, 4); SetFocus(btnSetApnea); }break; } gbKeyType = KEY_TAB; }break; } return 0; }break; } temp = (*OldEditProc)(hWnd, message, wParam, lParam); return(temp); }
/*---------------------------------------------------------------------------------------------- This processes Windows messages on the window. In general, it normally calls the appropriate method on the edit class. ----------------------------------------------------------------------------------------------*/ bool TssEdit::FWndProc(uint wm, WPARAM wp, LPARAM lp, long & lnRet) { bool fRet; switch (wm) { case WM_GETDLGCODE: // This is essential when embedded in a dialog to tell the dialog manager that it // wants to get key strokes. (We could try DLGC_WANTALLKEYS but I think we would then // get the Tab and Return keys...we may get them anyway with this combination...) // The last value tells Windows that when tabbing to this control we should use // EM_SETSEL to select all the text. lnRet = DLGC_WANTCHARS | DLGC_WANTARROWS | DLGC_HASSETSEL; return true; case EM_GETLINE: // Use FW_EM_GETLINE. case EM_REPLACESEL: // Use FW_EM_REPLACESEL. // We don't support these methods. Use the replacement TsString versions instead. Assert(false); lnRet = LB_ERR; return true; // NOTE: DO NOT send this message to a TssEdit if you want the actual text. Send the // FW_EM_GETTEXT message instead. This method is required for TssEdit controls on a // dialog because Windows will send the message to the control anytime the user hits a // key. case WM_GETTEXT: { ITsStringPtr qtss; GetText(&qtss); const wchar * pwrgch; int cch; HRESULT hr; IgnoreHr(hr = qtss->LockText(&pwrgch, &cch)); if (FAILED(hr)) return true; StrApp str(pwrgch, cch); qtss->UnlockText(pwrgch); lnRet = Min(cch + 1, (int)wp); achar * psz = reinterpret_cast<achar *>(lp); StrCpyN(psz, str.Chars(), lnRet); } return true; // NOTE: You should be sending an FW_EM_SETTEXT message instead of this. case WM_SETTEXT: { achar * psz = reinterpret_cast<achar *>(lp); StrUni stu(psz); ITsStrFactoryPtr qtsf; qtsf.CreateInstance(CLSID_TsStrFactory); ITsStringPtr qtss; CheckHr(qtsf->MakeStringRgch(stu.Chars(), stu.Length(), m_wsBase, &qtss)); SetText(qtss); } return true; case EM_CANUNDO: case EM_CHARFROMPOS: case EM_EMPTYUNDOBUFFER: case EM_FMTLINES: case EM_GETFIRSTVISIBLELINE: case EM_GETHANDLE: case EM_GETMODIFY: case EM_GETPASSWORDCHAR: case EM_GETRECT: case EM_GETTHUMB: case EM_GETWORDBREAKPROC: case EM_POSFROMCHAR: case EM_SETHANDLE: case EM_SETMODIFY: case EM_SETPASSWORDCHAR: case EM_SETRECT: case EM_SETRECTNP: case EM_SETTABSTOPS: case EM_SETWORDBREAKPROC: case EM_UNDO: case WM_GETFONT: case WM_SETFONT: // We don't support these methods. Assert(false); lnRet = LB_ERR; return true; case EM_GETLIMITTEXT: lnRet = GetLimitText(); return true; case FW_EM_GETLINE: lnRet = GetLine(wp, (ITsString **)lp); return true; case EM_GETLINECOUNT: lnRet = GetLineCount(); return true; case EM_GETMARGINS: lnRet = GetMargins(); return true; case FW_EM_GETSTYLE: GetStyle((StrUni *)lp, (COLORREF *)wp); return true; case EM_GETSEL: lnRet = GetSel((int *)wp, (int *)lp); return true; case EM_LINEFROMCHAR: lnRet = LineFromChar(wp); return true; case EM_LINEINDEX: lnRet = LineIndex(wp); return true; case EM_LINELENGTH: lnRet = LineLength(wp); return true; case EM_LINESCROLL: LineScroll(lp, wp); return true; case FW_EM_REPLACESEL: ReplaceSel((ITsString *)lp); return true; case EM_SCROLL: lnRet = ::SendMessage(m_hwnd, WM_VSCROLL, LOWORD(wp), 0); return true; case EM_SCROLLCARET: ScrollCaret(); return true; case EM_SETLIMITTEXT: SetLimitText(wp); return true; case EM_SETMARGINS: SetMargins(wp, LOWORD(lp), HIWORD(lp)); return true; case EM_SETREADONLY: SetReadOnly(wp); return true; case EM_SETSEL: SetSel(wp, lp); return true; case FW_EM_SETSTYLE: SetStyle((StrUni *)lp, (COLORREF)wp); return true; case WM_GETTEXTLENGTH: lnRet = GetTextLength(); return true; case FW_EM_GETTEXT: GetText((ITsString **)lp); return true; case FW_EM_SETTEXT: SetText((ITsString *)lp); return true; case WM_COPY: Copy(); return true; case WM_CUT: Cut(); return true; case WM_PASTE: Paste(); return true; case WM_HSCROLL: if (!OnHScroll(LOWORD(wp), HIWORD(wp), (HWND)lp)) { ::SendMessage(::GetParent(m_hwnd), WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_HSCROLL), (LPARAM)m_hwnd); } return true; case WM_VSCROLL: if (!OnVScroll(LOWORD(wp), HIWORD(wp), (HWND)lp)) { ::SendMessage(::GetParent(m_hwnd), WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_VSCROLL), (LPARAM)m_hwnd); } return true; case WM_KILLFOCUS: if (!OnKillFocus((HWND)wp)) { ::SendMessage(::GetParent(m_hwnd), WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_KILLFOCUS), (LPARAM)m_hwnd); } return true; case WM_SETFOCUS: if (!OnSetFocus((HWND)wp)) { ::SendMessage(::GetParent(m_hwnd), WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_SETFOCUS), (LPARAM)m_hwnd); } return true; // Calling SuperClass here causes two OnSetFocus calls for each OnKillFocus. //return SuperClass::FWndProc(wm, wp, lp, lnRet); case WM_CHAR: fRet = false; if (wp == VK_TAB) // '\t' { fRet = OnCharTab(); } else if (wp == VK_RETURN) // '\r' { fRet = OnCharEnter(); } else if (wp == VK_ESCAPE) // '\33' { fRet = OnCharEscape(); } if (fRet) return fRet; else return SuperClass::FWndProc(wm, wp, lp, lnRet); case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_MOUSEMOVE: if (HasToolTip()) { // Notify the tooltip belonging to the parent toolbar of the mouse message. Assert(m_hwndToolTip); MSG msg; msg.hwnd = m_hwnd; // ::GetParent(m_hwnd); msg.message = wm; msg.wParam = wp; msg.lParam = lp; ::SendMessage(m_hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg); } break; default: break; } return SuperClass::FWndProc(wm, wp, lp, lnRet); }
void CXTPReportInplaceEdit::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs) { SetItemArgs(pItemArgs); m_pSelectedConstraint = NULL; XTP_REPORTRECORDITEM_METRICS* pMetrics = new XTP_REPORTRECORDITEM_METRICS; CXTPReportRecordItemText* pTextItem = DYNAMIC_DOWNCAST(CXTPReportRecordItemText, pItem); pItemArgs->pRow->FillMetrics(pColumn, pItem, pMetrics); if (pTextItem != NULL) { pMetrics->strText = pTextItem->GetValue(); } else //not CXTPReportRecordItemText case! { pMetrics->strText = pItem->GetCaption(pColumn); } CXTPReportRecordItemEditOptions* pEditOptions = pItem->GetEditOptions(pColumn); ASSERT(pEditOptions); if (!pEditOptions) return; CRect rect = pItemArgs->rcItem; rect.DeflateRect(2, 1, 2, 2); m_clrText = pMetrics->clrForeground; m_strValue = pMetrics->strText; m_strText_prev = pMetrics->strText; DWORD dwEditStyle = WS_CHILD | pEditOptions->m_dwEditStyle; dwEditStyle &= ~(ES_LEFT | ES_RIGHT | ES_CENTER); if (pControl->GetPaintManager()->m_bUseEditTextAlignment) { if (pMetrics->nColumnAlignment & DT_RIGHT) dwEditStyle |= ES_RIGHT; else if (pMetrics->nColumnAlignment & DT_CENTER) dwEditStyle |= ES_CENTER; } if (m_hWnd) { DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_READONLY; if ((GetStyle() & dwStyle) != (dwEditStyle & dwStyle)) DestroyWindow(); } if (!m_hWnd) CEdit::Create(dwEditStyle, rect, pControl, 0); if (pControl->GetExStyle() & WS_EX_RTLREADING) ModifyStyleEx(0, WS_EX_RTLREADING); SetLimitText(pEditOptions->m_nMaxLength); //SetFocus(); SetFont(pMetrics->pFont); SetWindowText(m_strValue); pMetrics->InternalRelease(); if (rect.right > rect.left) { SetWindowPos(0, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW); SetFocus(); } else { HideWindow(); } SetMargins(0, 0); }
/* 编辑框回调函数 */ static int EditProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { int temp; int iVaue; int id; RECT rc; HDC hdc= (HDC)NULL; GetWindowRect(hWnd, &rc); switch(message){ case MSG_SETFOCUS:{ hdc = GetClientDC(GetParent(hWnd)); if(hdc != (HDC)NULL){ SetPenColor(hdc, SETFOCUS_COLOR); Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1); Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2); ReleaseDC(hdc); } }break; case MSG_KILLFOCUS:{ hdc = GetClientDC(GetParent(hWnd)); if(hdc !=(HDC)NULL){ SetPenColor(hdc, KILLFOCUS_COLOR); Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1); Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2); ReleaseDC(hdc); } }break; case MSG_KEYUP:{ id = GetDlgCtrlID(hWnd); switch(wParam){ case SCANCODE_CURSORBLOCKDOWN:{ switch(id){ case DID_RECORDER_DURATION_EDIT:{ if(iTmpTime < PRINT_LIMIT_TIME_MAX){ iTmpTime += PRINT_LIMIT_TIME_INTER; SetLimitText(hWnd, iTmpTime, 0); } }break; case DID_RECORDER_AUTO_EDIT:{ if(iTmpInter < PRINT_LIMIT_AUTO_MAX){ iTmpInter += PRINT_LIMIT_AUTO_INTER; SetLimitText(hWnd, iTmpInter, 1); } }break; } }break; case SCANCODE_CURSORBLOCKUP:{ switch(id){ case DID_RECORDER_DURATION_EDIT:{ if(iTmpTime > PRINT_LIMIT_TIME_MIN){ iTmpTime -= PRINT_LIMIT_TIME_INTER; SetLimitText(hWnd, iTmpTime, 0); } }break; case DID_RECORDER_AUTO_EDIT:{ if(iTmpInter > PRINT_LIMIT_AUTO_MIN){ iTmpInter -= PRINT_LIMIT_AUTO_INTER; SetLimitText(hWnd, iTmpInter, 1); } }break; } }break; case SCANCODE_ENTER:{ switch(id){ case DID_RECORDER_DURATION_EDIT:{ gCfgPrinter.iDuration = iTmpTime; SetIntValueToResFile(gFileSetup, "PrintSetup", "duration", gCfgPrinter.iDuration,3); SetFocus(btnDuration); }break; case DID_RECORDER_AUTO_EDIT:{ gCfgPrinter.iInter = iTmpInter; SetIntValueToResFile(gFileSetup, "PrintSetup", "inter", gCfgPrinter.iInter,3); SetFocus(btnAuto); }break; } gbKeyType = KEY_TAB; }break; } return 0; }break; } temp = (*OldEditProc)(hWnd, message, wParam, lParam); return(temp); }
/*************************************************** SetMask Sets the mask to use during editing. Params: string - mask string Return: UG_SUCCESS - success UG_ERROR - error ****************************************************/ int CUGMaskedEdit::SetMask(LPCTSTR string){ if(string == NULL){ m_useMask = FALSE; return UG_SUCCESS; } //set the mask m_origMask = string; if(m_origMask.GetLength() > 0) m_useMask = TRUE; else{ m_useMask = FALSE; return UG_SUCCESS; } int loop,loop2,pos; int len = m_origMask.GetLength(); TCHAR *buf = new TCHAR[len+1]; int maskChar; #ifdef WIN32 SetLimitText(len); #else SendMessage(EM_LIMITTEXT,len,0); #endif //get the parsed mask pos =0; for(loop =0;loop < len;loop++){ //check to see if the next mask char is a literal if(m_origMask.GetAt(loop)=='\\'){ loop++; continue; } //check for each of the possible mask chars maskChar = FALSE; for(loop2 = 0 ;loop2 < 9;loop2++){ if(m_origMask.GetAt(loop) == m_maskChars[loop2]){ maskChar = TRUE; break; } } //copy the retults if(maskChar) buf[pos] = m_origMask[loop]; else buf[pos] = 8; pos++; } //copy over the final mask string buf[pos]=0; m_mask = buf; //get the parsed literals pos =0; for(loop =0;loop < len;loop++){ maskChar = FALSE; //check to see if the next mask char is a literal if(m_origMask.GetAt(loop)=='\\'){ loop++; } else{ //check for each of the possible mask chars for(loop2 = 0 ;loop2 < 9;loop2++){ if(m_origMask.GetAt(loop) == m_maskChars[loop2]){ maskChar = TRUE; break; } } } //copy the retults if(maskChar) buf[pos] = 8; else buf[pos] = m_origMask[loop]; pos++; } //copy over the final literal string buf[pos]=0; m_literals = buf; delete[] buf; OnUpdate(); return UG_SUCCESS; }
static int InitEditCtl() { //获取各模块报警上下限 iTmpHighHR =gCfgEcg.wHigh_HR, iTmpLowHR =gCfgEcg.wLow_HR; iTmpHighSpo2 =gCfgSpO2.bHigh_SpO2, iTmpLowSpo2 = gCfgSpO2.bLow_SpO2; iTmpHighNIBPSys =gCfgNibp.wHigh_Sys, iTmpLowNIBPSys =gCfgNibp.wLow_Sys; iTmpHighNIBPDia =gCfgNibp.wHigh_Dia, iTmpLowNIBPDia = gCfgNibp.wLow_Dia; iTmpHighNIBPMean =gCfgNibp.wHigh_Mean, iTmpLowNIBPMean = gCfgNibp.wLow_Mean; iTmpHighResp =gCfgResp.wHigh_RR, iTmpLowResp =gCfgResp.wLow_RR; iTmpHighT1=gCfgTemp.wHigh_T1, iTmpLowT1=gCfgTemp.wLow_T1; iTmpHighT2=gCfgTemp.wHigh_T2, iTmpLowT2 = gCfgTemp.wLow_T2; //初始化 SetLimitText(highHR,iTmpHighHR); SetLimitText(highSpo2,iTmpHighSpo2); SetLimitText(highNIBPSys,iTmpHighNIBPSys); SetLimitText(highNIBPDia,iTmpHighNIBPDia); SetLimitText(highNIBPMean,iTmpHighNIBPMean); SetLimitText(highResp,iTmpHighResp); SetLimitText(highT1,iTmpHighT1); SetLimitText(highT2,iTmpHighT2); SetLimitText(lowHR,iTmpLowHR); SetLimitText(lowSpo2,iTmpLowSpo2); SetLimitText(lowNIBPSys,iTmpLowNIBPSys); SetLimitText(lowNIBPDia,iTmpLowNIBPDia); SetLimitText(lowNIBPMean,iTmpLowNIBPMean); SetLimitText(lowResp,iTmpLowResp); SetLimitText(lowT1,iTmpLowT1); SetLimitText(lowT2,iTmpLowT2); return 0; }
static int EditProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { int temp; int iVaue; int id; RECT rc; HDC hdc= (HDC)NULL; GetWindowRect(hWnd, &rc); switch(message){ case MSG_SETFOCUS:{ hdc = GetClientDC(GetParent(hWnd)); if(hdc != (HDC)NULL){ SetPenColor(hdc, SETFOCUS_COLOR); Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1); Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2); ReleaseDC(hdc); SendMessage(editHelp, MSG_PAINT, 0, (LPARAM)GetDlgCtrlID(hWnd)); } }break; case MSG_KILLFOCUS:{ hdc = GetClientDC(GetParent(hWnd)); if(hdc !=(HDC)NULL){ SetPenColor(hdc, KILLFOCUS_COLOR); Rectangle(hdc, rc.left-1, rc.top-1, rc.right+1, rc.bottom+1); Rectangle(hdc, rc.left-2, rc.top-2, rc.right+2, rc.bottom+2); ReleaseDC(hdc); } }break; case MSG_KEYUP:{ id = GetDlgCtrlID(hWnd); switch(wParam){ case SCANCODE_CURSORBLOCKDOWN:{ switch(id){ case DID_COMMONALM_HR_HIGH:{ if(iTmpHighHR<HR_LIMIT_MAX){ iTmpHighHR += LIMIT_INTER; SetLimitText(hWnd, iTmpHighHR); } }break; case DID_COMMONALM_SPO2_HIGH:{ if(iTmpHighSpo2<SPO2_LIMIT_MAX){ iTmpHighSpo2 += LIMIT_INTER; SetLimitText(hWnd, iTmpHighSpo2); } }break; case DID_COMMONALM_NIBPSYS_HIGH:{ if(iTmpHighNIBPSys<NIBPSYS_LIMIT_MAX){ iTmpHighNIBPSys += LIMIT_INTER; SetLimitText(hWnd, iTmpHighNIBPSys); } }break; case DID_COMMONALM_NIBPDIA_HIGH:{ if(iTmpHighNIBPDia<NIBPDIA_LIMIT_MAX){ iTmpHighNIBPDia += LIMIT_INTER; SetLimitText(hWnd, iTmpHighNIBPDia); } }break; case DID_COMMONALM_NIBPMEAN_HIGH:{ if(iTmpHighNIBPMean<NIBPMEAN_LIMIT_MAX){ iTmpHighNIBPMean += LIMIT_INTER; SetLimitText(hWnd, iTmpHighNIBPMean); } }break; case DID_COMMONALM_RESP_HIGH:{ if(iTmpHighResp<RESP_LIMIT_MAX){ iTmpHighResp += LIMIT_INTER; SetLimitText(hWnd, iTmpHighResp); } }break; case DID_COMMONALM_T1_HIGH:{ if(iTmpHighT1<T1_LIMIT_MAX){ iTmpHighT1 += LIMIT_INTER; SetLimitText(hWnd, iTmpHighT1); } }break; case DID_COMMONALM_T2_HIGH:{ if(iTmpHighT2<T2_LIMIT_MAX){ iTmpHighT2 += LIMIT_INTER; SetLimitText(hWnd, iTmpHighT2); } }break; case DID_COMMONALM_HR_LOW:{ if(iTmpLowHR<HR_LIMIT_MAX&&iTmpLowHR<iTmpHighHR){ iTmpLowHR += LIMIT_INTER; SetLimitText(hWnd, iTmpLowHR); } }break; case DID_COMMONALM_SPO2_LOW:{ if(iTmpLowSpo2<SPO2_LIMIT_MAX&&iTmpLowSpo2<iTmpHighSpo2){ iTmpLowSpo2 += LIMIT_INTER; SetLimitText(hWnd, iTmpLowSpo2); } }break; case DID_COMMONALM_NIBPSYS_LOW:{ if(iTmpLowNIBPSys<NIBPSYS_LIMIT_MAX&&iTmpLowNIBPSys<iTmpHighNIBPSys){ iTmpLowNIBPSys += LIMIT_INTER; SetLimitText(hWnd, iTmpLowNIBPSys); } }break; case DID_COMMONALM_NIBPDIA_LOW:{ if(iTmpLowNIBPDia<NIBPDIA_LIMIT_MAX&&iTmpLowNIBPDia<iTmpHighNIBPDia){ iTmpLowNIBPDia += LIMIT_INTER; SetLimitText(hWnd, iTmpLowNIBPDia); } }break; case DID_COMMONALM_NIBPMEAN_LOW:{ if(iTmpLowNIBPMean<NIBPMEAN_LIMIT_MAX&&iTmpLowNIBPMean<iTmpHighNIBPMean){ iTmpLowNIBPMean += LIMIT_INTER; SetLimitText(hWnd, iTmpLowNIBPMean); } }break; case DID_COMMONALM_RESP_LOW:{ if(iTmpLowResp<RESP_LIMIT_MAX&&iTmpLowResp<iTmpHighResp){ iTmpLowResp += LIMIT_INTER; SetLimitText(hWnd, iTmpLowResp); } }break; case DID_COMMONALM_T1_LOW:{ if(iTmpLowT1<T1_LIMIT_MAX&&iTmpLowT1<iTmpHighT1){ iTmpLowT1 += LIMIT_INTER; SetLimitText(hWnd, iTmpLowT1); } }break; case DID_COMMONALM_T2_LOW:{ if(iTmpLowT2<T2_LIMIT_MAX&&iTmpLowT2<iTmpHighT2){ iTmpLowT2 += LIMIT_INTER; SetLimitText(hWnd, iTmpLowT2); } }break; } }break; case SCANCODE_CURSORBLOCKUP:{ switch(id){ case DID_COMMONALM_HR_HIGH:{ if(iTmpHighHR>HR_LIMIT_MIN&&iTmpHighHR>iTmpLowHR){ iTmpHighHR -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighHR); } }break; case DID_COMMONALM_SPO2_HIGH:{ if(iTmpHighSpo2>SPO2_LIMIT_MIN&&iTmpHighSpo2>iTmpLowSpo2){ iTmpHighSpo2 -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighSpo2); } }break; case DID_COMMONALM_NIBPSYS_HIGH:{ if(iTmpHighNIBPSys>NIBPSYS_LIMIT_MIN&&iTmpHighNIBPSys>iTmpLowNIBPSys){ iTmpHighNIBPSys -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighNIBPSys); } }break; case DID_COMMONALM_NIBPDIA_HIGH:{ if(iTmpHighNIBPDia>NIBPDIA_LIMIT_MIN&&iTmpHighNIBPDia>iTmpLowNIBPDia){ iTmpHighNIBPDia -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighNIBPDia); } }break; case DID_COMMONALM_NIBPMEAN_HIGH:{ if(iTmpHighNIBPMean>NIBPMEAN_LIMIT_MIN&&iTmpHighNIBPMean>iTmpLowNIBPMean){ iTmpHighNIBPMean -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighNIBPMean); } }break; case DID_COMMONALM_RESP_HIGH:{ if(iTmpHighResp>RESP_LIMIT_MIN&&iTmpHighResp>iTmpLowResp){ iTmpHighResp -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighResp); } }break; case DID_COMMONALM_T1_HIGH:{ if(iTmpHighT1>T1_LIMIT_MIN&&iTmpHighT1>iTmpLowT1){ iTmpHighT1 -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighT1); } }break; case DID_COMMONALM_T2_HIGH:{ if(iTmpHighT2>T2_LIMIT_MIN&&iTmpHighT2>iTmpLowT2){ iTmpHighT2 -= LIMIT_INTER; SetLimitText(hWnd, iTmpHighT2); } }break; case DID_COMMONALM_HR_LOW:{ if(iTmpLowHR>HR_LIMIT_MIN){ iTmpLowHR -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowHR); } }break; case DID_COMMONALM_SPO2_LOW:{ if(iTmpLowSpo2>SPO2_LIMIT_MIN){ iTmpLowSpo2 -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowSpo2); } }break; case DID_COMMONALM_NIBPSYS_LOW:{ if(iTmpLowNIBPSys>NIBPSYS_LIMIT_MIN){ iTmpLowNIBPSys -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowNIBPSys); } }break; case DID_COMMONALM_NIBPDIA_LOW:{ if(iTmpLowNIBPDia>NIBPDIA_LIMIT_MIN){ iTmpLowNIBPDia -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowNIBPDia); } }break; case DID_COMMONALM_NIBPMEAN_LOW:{ if(iTmpLowNIBPMean>NIBPMEAN_LIMIT_MIN){ iTmpLowNIBPMean -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowNIBPMean); } }break; case DID_COMMONALM_RESP_LOW:{ if(iTmpLowResp>RESP_LIMIT_MIN){ iTmpLowResp -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowResp); } }break; case DID_COMMONALM_T1_LOW:{ if(iTmpLowT1>T1_LIMIT_MIN){ iTmpLowT1 -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowT1); } }break; case DID_COMMONALM_T2_LOW:{ if(iTmpLowT2>T2_LIMIT_MIN){ iTmpLowT2 -= LIMIT_INTER; SetLimitText(hWnd, iTmpLowT2); } }break; } }break; case SCANCODE_ENTER:{ switch(id){ case DID_COMMONALM_HR_HIGH:{ gCfgEcg.wHigh_HR= iTmpHighHR; SetIntValueToResFile(gFileSetup, "ECGSetup", "hr_high", gCfgEcg.wHigh_HR, 3); SetFocus(lowHR); }break; case DID_COMMONALM_SPO2_HIGH:{ gCfgSpO2.bHigh_SpO2= iTmpHighSpo2; SetIntValueToResFile(gFileSetup, "SPO2Setup", "spo2_high", gCfgSpO2.bHigh_SpO2, 3); SetFocus(lowSpo2); }break; case DID_COMMONALM_NIBPSYS_HIGH:{ gCfgNibp.wHigh_Sys= iTmpHighNIBPSys; SetIntValueToResFile(gFileSetup, "NIBPSetup", "sys_high", gCfgNibp.wHigh_Sys, 3); SetFocus(lowNIBPSys); }break; case DID_COMMONALM_NIBPDIA_HIGH:{ gCfgNibp.wHigh_Dia= iTmpHighNIBPDia; SetIntValueToResFile(gFileSetup, "NIBPSetup", "dia_high", gCfgNibp.wHigh_Dia, 3); SetFocus(lowNIBPDia); }break; case DID_COMMONALM_NIBPMEAN_HIGH:{ gCfgNibp.wHigh_Mean= iTmpHighNIBPMean; SetIntValueToResFile(gFileSetup, "NIBPSetup", "mean_high", gCfgNibp.wHigh_Mean, 3); SetFocus(lowNIBPMean); }break; case DID_COMMONALM_RESP_HIGH:{ gCfgResp.wHigh_RR= iTmpHighResp; SetIntValueToResFile(gFileSetup, "RESPSetup", "rr_high", gCfgResp.wHigh_RR, 3); SetFocus(lowResp); }break; case DID_COMMONALM_T1_HIGH:{ gCfgTemp.wHigh_T1= iTmpHighT1; SetIntValueToResFile(gFileSetup, "TEMPSetup", "t1_high", gCfgTemp.wHigh_T1, 3); SetFocus(lowT1); }break; case DID_COMMONALM_T2_HIGH:{ gCfgTemp.wHigh_T2= iTmpHighT2; SetIntValueToResFile(gFileSetup, "TEMPSetup", "t2_high", gCfgTemp.wHigh_T2, 3); SetFocus(lowT2); }break; case DID_COMMONALM_HR_LOW:{ gCfgEcg.wLow_HR= iTmpLowHR; SetIntValueToResFile(gFileSetup, "ECGSetup", "hr_low", gCfgEcg.wLow_HR, 3); gbKeyType = KEY_TAB; SetFocus(btnHR); }break; case DID_COMMONALM_SPO2_LOW:{ gCfgSpO2.bLow_SpO2= iTmpLowSpo2; SetIntValueToResFile(gFileSetup, "SPO2Setup", "spo2_low", gCfgSpO2.bLow_SpO2, 3); gbKeyType = KEY_TAB; SetFocus(btnSpo2); }break; case DID_COMMONALM_NIBPSYS_LOW:{ gCfgNibp.wLow_Sys= iTmpLowNIBPSys; SetIntValueToResFile(gFileSetup, "NIBPSetup", "sys_low", gCfgNibp.wLow_Sys, 3); gbKeyType = KEY_TAB; SetFocus(btnNIBPSys); }break; case DID_COMMONALM_NIBPDIA_LOW:{ gCfgNibp.wLow_Dia= iTmpLowNIBPDia; SetIntValueToResFile(gFileSetup, "NIBPSetup", "dia_low", gCfgNibp.wLow_Dia, 3); gbKeyType = KEY_TAB; SetFocus(btnNIBPDia); }break; case DID_COMMONALM_NIBPMEAN_LOW:{ gCfgNibp.wLow_Mean= iTmpLowNIBPMean; SetIntValueToResFile(gFileSetup, "NIBPSetup", "mean_low", gCfgNibp.wLow_Mean, 3); gbKeyType = KEY_TAB; SetFocus(btnNIBPMean); }break; case DID_COMMONALM_RESP_LOW:{ gCfgResp.wLow_RR= iTmpLowResp; SetIntValueToResFile(gFileSetup, "RESPSetup", "rr_low", gCfgResp.wLow_RR, 3); gbKeyType = KEY_TAB; SetFocus(btnResp); }break; case DID_COMMONALM_T1_LOW:{ gCfgTemp.wLow_T1= iTmpLowT1; SetIntValueToResFile(gFileSetup, "TEMPSetup", "t1_low", gCfgTemp.wLow_T1, 3); gbKeyType = KEY_TAB; SetFocus(btnT1); }break; case DID_COMMONALM_T2_LOW:{ gCfgTemp.wLow_T2= iTmpLowT2; SetIntValueToResFile(gFileSetup, "TEMPSetup", "t2_low", gCfgTemp.wLow_T2, 3); gbKeyType = KEY_TAB; SetFocus(btnT2); }break; } }break; } return 0; }break; } temp = (*OldEditProc)(hWnd, message, wParam, lParam); return(temp); }