void CRichEditCtrlX::UpdateSyntaxColoring() { CString strText; GetWindowText(strText); if (strText.IsEmpty()) return; m_bSelfUpdate = true; long lCurSelStart, lCurSelEnd; GetSel(lCurSelStart, lCurSelEnd); SetSel(0, -1); SetSelectionCharFormat(m_cfDef); SetSel(lCurSelStart, lCurSelEnd); LPTSTR pszStart = const_cast<LPTSTR>((LPCTSTR)strText); LPCTSTR psz = pszStart; while (*psz != _T('\0')) { if (*psz == _T('\"')) { LPCTSTR pszEnd = _tcschr(psz + 1, _T('\"')); if (pszEnd) psz = pszEnd + 1; else break; } else { bool bFoundKeyword = false; for (int k = 0; k < m_astrKeywords.GetCount(); k++) { const CString& rstrKeyword = m_astrKeywords[k]; int iKwLen = rstrKeyword.GetLength(); if (_tcsncmp(psz, rstrKeyword, iKwLen)==0 && (psz[iKwLen]==_T('\0') || _tcschr(m_strSeperators, psz[iKwLen])!=NULL)) { long iStart = static_cast<long>(psz - pszStart); long iEnd = static_cast<long>(iStart + iKwLen); long lCurSelStart, lCurSelEnd; GetSel(lCurSelStart, lCurSelEnd); SetSel(iStart, iEnd); SetSelectionCharFormat(m_cfKeyword); SetSel(lCurSelStart, lCurSelEnd); psz += iKwLen; bFoundKeyword = true; break; } } if (!bFoundKeyword) psz++; } } UpdateWindow(); m_bSelfUpdate = false; }
void WINAPI duListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { int nItemCount = GetItemCount(); if (nItemCount == 0) return; if (nChar == VK_UP) { int nSel = GetSel(); nSel--; if (nSel < 0) nSel = 0; if (nSel >= nItemCount) nSel = nItemCount - 1; SetSel(nSel); duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll); if (pScroll) { pScroll->SetPos(m_nItemHeight * nSel); UpdateScroll(); } if (!m_fCombobox) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else { FadeRedraw(); } } else if (nChar == VK_DOWN) { int nSel = GetSel(); _TRACE(_T("nSel :%d\n"), nSel); nSel++; if (nSel >= nItemCount) nSel = nItemCount - 1; if (nSel < 0) nSel = 0; SetSel(nSel); duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll); if (pScroll) { pScroll->SetPos(m_nItemHeight * nSel); UpdateScroll(); } if (!m_fCombobox) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else FadeRedraw(); } }
BOOL CMyDateEdit::CheckChar(UINT nChar) { int nTime = 0; //如果不使用掩码,则返回 if(!m_bUseMask) return TRUE; //如果是控制字符,则返回 if(!isprint(nChar)) return TRUE; if(!isdigit(nChar)) { MessageBeep((UINT)-1); return FALSE; } //如果存在选择区域,则取消选择 int startPos,endPos; GetSel(startPos,endPos); SetSel(-1,0); //重新选中原选择区域的第一个字符 SetSel(startPos,startPos); GetSel(startPos,endPos); //确保字符串的长度不超过掩码的长度 if(endPos>=m_strMask.GetLength()) { MessageBeep((UINT)-1); return FALSE; } //时间格式 if(m_isTime) { if(!CheckTime(nChar,startPos,endPos)) { return FALSE; } } //日期格式 if(m_isDate) { if(!CheckDate(nChar,startPos,startPos)) { return FALSE; } } if(m_isDateTime) { if(!CheckDate(nChar,startPos,startPos)) { return FALSE; } if(!CheckTime(nChar,startPos,startPos)) { return FALSE; } } return TRUE; }
void NativeTextfieldWin::OnAfterPossibleChange(bool should_redraw_text) { // Prevent the user from selecting the "phantom newline" at the end of the // edit. If they try, we just silently move the end of the selection back to // the end of the real text. CHARRANGE new_sel; GetSel(new_sel); const int length = GetTextLength(); if(new_sel.cpMax > length) { new_sel.cpMax = length; if(new_sel.cpMin > length) { new_sel.cpMin = length; } SetSel(new_sel); } std::wstring new_text(GetText()); if(new_text != text_before_change_) { if(ime_discard_composition_ && ime_composition_start_>=0 && ime_composition_length_>0) { // A string retrieved with a GetText() call contains a string being // composed by an IME. We remove the composition string from this search // string. new_text.erase(ime_composition_start_, ime_composition_length_); ime_composition_start_ = 0; ime_composition_length_ = 0; if(new_text.empty()) { return; } } textfield_->SyncText(); UpdateAccessibleValue(textfield_->text()); if(should_redraw_text) { CHARRANGE original_sel; GetSel(original_sel); std::wstring text = GetText(); ScopedSuspendUndo suspend_undo(GetTextObjectModel()); SelectAll(); ReplaceSel(reinterpret_cast<LPCTSTR>(text.c_str()), true); SetSel(original_sel); } } }
///////////////////////////////////////////////////////////////////////////// // CMyDateEdit message handlers void CMyDateEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { CString str; GetWindowText(str); for (int i = 0; i<str.GetLength() && i<m_str.GetLength();i++) m_str.SetAt(i, str.GetAt(i)); if(!m_bMaskKeyInProgress) if(!CheckChar(nChar)) return; if(m_bUseMask) //要使用掩码 { if(isdigit(nChar)) //是可打印字符 { int startPos,endPos; GetSel(startPos,endPos); SetSel(startPos,endPos+1); if(m_strMask.GetAt(startPos)=='-'||m_strMask.GetAt(startPos)==':'||m_strMask.GetAt(startPos)==' ') { SetSel(startPos+1,startPos+1); SendChar(nChar); return; } } else if(nChar==VK_BACK) { int startPos,endPos; GetSel(startPos,endPos); if((startPos==endPos) && (startPos>=1) && (startPos<=m_str.GetLength())) { char c; c=m_strMask.GetAt(startPos-1); if(c=='-'||c==':'||c==' ') { SetSel(startPos-1,startPos-1); return; } ////回退光标 SetSel(startPos-1,startPos-1); SendChar(c); //再次退回 SendMessage(WM_KEYDOWN,VK_LEFT,0); } else //越界或者存在选择区域 MessageBeep((UINT)-1); return; } } CEdit::OnChar(nChar, nRepCnt, nFlags); }
void CIntEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if (!(nChar >= '0' && nChar <= '9' || nChar == '-' || nChar == '\b')) { return; } CString str; GetWindowText(str); if (nChar == '-' && !str.IsEmpty() && str[0] == '-') { return; } int nStartChar, nEndChar; GetSel(nStartChar, nEndChar); if (nChar == '\b' && nStartChar <= 0) { return; } if (nChar == '-' && (nStartChar != 0 || nEndChar != 0)) { return; } CEdit::OnChar(nChar, nRepCnt, nFlags); }
void CPropTreeItemFileEdit::OnContextMenu(CWnd *pWnd, CPoint point) { CMenu FloatingMenu; VERIFY(FloatingMenu.LoadMenu(IDR_ME_EDIT_MENU)); CMenu *pPopupMenu = FloatingMenu.GetSubMenu(0); if (CanUndo()) { pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_ENABLED); } else { pPopupMenu->EnableMenuItem(ID_EDIT_UNDO, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); } DWORD dwSel = GetSel(); if (HIWORD(dwSel) != LOWORD(dwSel)) { pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_ENABLED); pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_ENABLED); pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_ENABLED); } else { pPopupMenu->EnableMenuItem(ID_EDIT_CUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); pPopupMenu->EnableMenuItem(ID_EDIT_COPY, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); pPopupMenu->EnableMenuItem(ID_EDIT_DELETE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); } pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); }
void CPWL_Edit::PasteText() { if (!CanPaste()) return; CFX_WideString swClipboard; if (IFX_SystemHandler* pSH = GetSystemHandler()) swClipboard = pSH->GetClipboardText(GetAttachedHWnd()); if (m_pFillerNotify) { FX_BOOL bRC = TRUE; FX_BOOL bExit = FALSE; CFX_WideString strChangeEx; int nSelStart = 0; int nSelEnd = 0; GetSel(nSelStart, nSelEnd); m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swClipboard, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, 0); if (!bRC) return; if (bExit) return; } if (swClipboard.GetLength() > 0) { Clear(); InsertText(swClipboard.c_str()); } }
FX_BOOL CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) { if (m_bMouseDown) return TRUE; if (nChar == FWL_VKEY_Delete) { if (m_pFillerNotify) { FX_BOOL bRC = TRUE; FX_BOOL bExit = FALSE; CFX_WideString strChange; CFX_WideString strChangeEx; int nSelStart = 0; int nSelEnd = 0; GetSel(nSelStart, nSelEnd); if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag); if (!bRC) return FALSE; if (bExit) return FALSE; } } FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); // In case of implementation swallow the OnKeyDown event. if (IsProceedtoOnChar(nChar, nFlag)) return TRUE; return bRet; }
void CFileListBox::OnContextMenu(CWnd* pWnd, CPoint point) { UNUSED_ALWAYS(pWnd); CMenu menu; menu.LoadMenu(IDR_TT_CONTEXTMENU); CMenu *pPopup=menu.GetSubMenu(0); /* ScreenToClient(&point); BOOL bOutside; m_nIndex=ItemFromPoint(point,bOutside); CRect rect; GetItemRect(m_nIndex,rect); if(bOutside || !rect.PtInRect(point)){ pPopup->EnableMenuItem(IDC_TT_REMOVE,MF_BYCOMMAND|MF_GRAYED); } ClientToScreen(&point); */ for(int i=0;i<GetCount();i++){ if(GetSel(i)){ break; } } if(i==GetCount()){ pPopup->EnableMenuItem(IDC_TT_REMOVE,MF_BYCOMMAND|MF_GRAYED); } pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x,point.y,this); }
LRESULT CUrlRichEditCtrl::OnDropFiles(WPARAM wp, LPARAM /*lp*/) { CHARRANGE crSelOrg; GetSel(crSelOrg); // save this off BOOL bEnable = !(GetStyle() & ES_READONLY) && IsWindowEnabled(); if (!bEnable) return 0; CStringArray aFiles; CString sText; SetSel(m_crDropSel); int nNumFiles = FileMisc::GetDropFilePaths((HDROP)wp, aFiles); ::DragFinish((HDROP)wp); ::CloseClipboard(); if (nNumFiles > 0) return CRichEditHelper::PasteFiles(*this, aFiles, REP_ASFILEURL); // else return nNumFiles; }
BOOL CFulEditCtrl::ShowMenu(HWND hWnd, POINT &pt){ ScreenToClient(&pt); CHARRANGE cr; GetSel(cr); if(cr.cpMax != cr.cpMin) { TCHAR *buf = new TCHAR[cr.cpMax - cr.cpMin + 1]; GetSelText(buf); searchTerm = Util::replace(buf, _T("\r"), _T("\r\n")); delete[] buf; } else { tstring line; tstring::size_type ch = TextUnderCursor(pt, line); if( ch != tstring::npos ) { tstring::size_type start = line.find_last_of(_T(" \t\r"), ch) + 1; tstring::size_type end = line.find_first_of(_T(" \t\r"), start); if(end == tstring::npos) { end = line.length(); } searchTerm = line.substr(start, end-start); } } ClientToScreen(&pt); WinUtil::AppendSearchMenu(searchMenu); return menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, hWnd ); }
void CInPlaceFloatEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar == VK_ESCAPE || nChar == VK_RETURN) { if (nChar == VK_ESCAPE) { m_bESC = TRUE; } GetParent()->SetFocus(); return; } if (nChar == ',') { nChar = '.'; } if (!(nChar >= '0' && nChar <= '9' || nChar == '.' || nChar == '\b')) { return; } CString str; GetWindowText(str); if ((nChar == '.') && str.Find('.') >= 0) { int nStartChar, nEndChar; GetSel(nStartChar, nEndChar); if (!(nStartChar < nEndChar && str.Mid(nStartChar, nEndChar - nStartChar).Find('.') >= 0)) { return; } } //CEdit::OnChar(nChar, nRepCnt, nFlags); DefWindowProc(WM_CHAR, nChar, MAKELONG(nRepCnt, nFlags)); }
/*---------------------------------------------------------------------------------------------- Enable/Disable Edit buttons. Copy, Paste, Select All always enabled. Cut enabled whenever there is a selection. @param cms @return true ----------------------------------------------------------------------------------------------*/ bool AfDeFeEdBoxBut::DeEdit::CmsEditUpdate(CmdState & cms) { switch (cms.Cid()) { case kcidEditCut: case kcidEditCopy: { int ichAnchor = 0; int ichEnd = 0; // When we click on another editor, the outgoing editor gets closed before the // command handler empties its queue (apparently). In any case, we come in here // with m_hwnd == NULL. So we need to catch this here, unless there is a better way. if (m_hwnd) GetSel(&ichAnchor, &ichEnd); cms.Enable(ichAnchor != ichEnd); } break; case kcidEditPaste: case kcidEditDel: case kcidEditSelAll: cms.Enable(true); break; default: Assert(false); cms.Enable(false); break; } return true; }
/* * CTxtEdit::ObjectFromIOB * * @mfunc Gets an object based on an IOB type index. * * @rdesc: * pointer to COleObject or NULL if none. */ COleObject * CTxtEdit::ObjectFromIOB(LONG iob) { COleObject * pobj = NULL; CObjectMgr * pobjmgr = NULL; pobjmgr = GetObjectMgr(); if (!pobjmgr) { return NULL; } // Figure out the index of the selection if (iob == REO_IOB_SELECTION) { CTxtSelection * psel = GetSel(); pobj = pobjmgr->GetFirstObjectInRange(psel->GetCpMin(), psel->GetCpMost()); } else { // Make sure the IOB is in range if ((0 <= iob) && (iob < GetObjectCount())) { pobj = pobjmgr->GetObjectFromIndex(iob); } } return pobj; }
/* ================ CSyntaxRichEditCtrl::GetNameBeforeCurrentSelection ================ */ bool CSyntaxRichEditCtrl::GetNameBeforeCurrentSelection(CString &name, int &charIndex) const { long selStart, selEnd; int line, column, length; char buffer[1024]; GetSel(selStart, selEnd); charIndex = selStart; line = LineFromChar(selStart); length = GetLine(line, buffer, sizeof(buffer)); column = selStart - LineIndex(line) - 1; do { buffer[column--] = '\0'; } while (charType[buffer[column]] == CT_WHITESPACE); for (length = 0; length < column; length++) { if (charType[buffer[column-length-1]] != CT_NAME) { break; } } if (length > 0) { name = buffer + column - length; return true; } return false; }
/* ================ CSyntaxRichEditCtrl::BracedSectionEnd ================ */ bool CSyntaxRichEditCtrl::BracedSectionEnd(char braceStartChar, char braceEndChar) { long selStart, selEnd; int brace, i; idStr text; GetSel(selStart, selEnd); GetText(text, 0, GetTextLength()); for (brace = 1, i = Min(selStart-2, (long)text.Length()-1); i >= 0; i--) { if (text[i] == braceStartChar) { brace--; if (brace == 0) { break; } } else if (text[i] == braceEndChar) { brace++; } } if (brace == 0) { bracedSection[0] = i; bracedSection[1] = selStart - 1; BracedSectionAdjustEndTabs(); BracedSectionShow(); } return (brace == 0); }
/* ================ CSyntaxRichEditCtrl::BracedSectionStart ================ */ bool CSyntaxRichEditCtrl::BracedSectionStart(char braceStartChar, char braceEndChar) { long selStart, selEnd; int brace, i; idStr text; GetSel(selStart, selEnd); GetText(text, 0, GetTextLength()); for (brace = 1, i = selStart; i < text.Length(); i++) { if (text[i] == braceStartChar) { brace++; } else if (text[i] == braceEndChar) { brace--; if (brace == 0) { break; } } } if (brace == 0) { bracedSection[0] = selStart - 1; bracedSection[1] = i; BracedSectionShow(); } return (brace == 0); }
void CPropTreeItemFileEdit::OnInsertFile() { CFileDialog dlg(TRUE); dlg.m_ofn.Flags |= OFN_FILEMUSTEXIST; int startSel, endSel; GetSel(startSel, endSel); if (dlg.DoModal()== IDOK) { idStr currentText = (char *)GetItemValue(); idStr newText = currentText.Left(startSel) + currentText.Right(currentText.Length() - endSel); idStr filename = fileSystem->OSPathToRelativePath(dlg.m_ofn.lpstrFile); filename.BackSlashesToSlashes(); newText.Insert(filename, startSel); SetItemValue((LPARAM)newText.c_str()); m_pProp->RefreshItems(this); m_pProp->SendNotify(PTN_ITEMCHANGED, this); } }
void CTitleTimeEdit::KeyInDel() { int nCharPos = CharFromPos(GetCaretPos()); int nSelStart = 0; int nSelEnd = 0; GetSel(nSelStart, nSelEnd); if(nSelStart == nSelEnd) { if(nCharPos < 12) { m_szTimeChar[nCharPos] = s_szDefTMChar[nCharPos]; nCharPos ++; if(s_szDefTMChar[nCharPos] != '0') nCharPos ++; } } else { DeleteRange(nSelStart, nSelEnd); } Update(); SetSel(nCharPos, nCharPos); }
LRESULT ChatCtrl::OnRButtonDown(POINT pt) { selectedLine = LineFromPos(pt); selectedUser.clear(); selectedIP.clear(); // Po kliku dovnitr oznaceneho textu si zkusime poznamenat pripadnej nick ci ip... // jinak by nam to neuznalo napriklad druhej klik na uz oznaceny nick =) long lSelBegin = 0, lSelEnd = 0; GetSel(lSelBegin, lSelEnd); int iCharPos = CharFromPos(pt), iBegin = 0, iEnd = 0; if((lSelEnd > lSelBegin) && (iCharPos >= lSelBegin) && (iCharPos <= lSelEnd)) { if(!HitIP(pt, selectedIP, iBegin, iEnd)) HitNick(pt, selectedUser, iBegin, iEnd); return 1; } // hightlight IP or nick when clicking on it if(HitIP(pt, selectedIP, iBegin, iEnd) || HitNick(pt, selectedUser, iBegin, iEnd)) { SetSel(iBegin, iEnd); InvalidateRect(NULL); } return 1; }
void CGuiEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: Add your message handler code here and/or call default if (!m_szMask.IsEmpty()) { if (nChar == VK_DELETE) { m_KeySpecial=1; AfxCallWndProc(this, m_hWnd, WM_CHAR, ' ', 1); return; } if (nChar == VK_BACK) { m_KeySpecial=2; return; } if(nChar == VK_RIGHT) { int nStartPos, nEndPos; GetSel( nStartPos, nEndPos ); m_KeySpecial=3; if (!ValSpecialKey(nStartPos,nEndPos)) SetSel(nStartPos,nStartPos); else { int nNext = GetNextPos(nStartPos); SetSel(nNext,nNext); } return; } } CEdit::OnKeyDown(nChar, nRepCnt, nFlags); }
void CEditInt::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { DWORD dw = GetSel(); switch(nChar) { case _T('+'): case _T('-'): if (LOWORD(dw) != 0) return; break; case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'): case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'): case _T('\b'): break; default: return; } CEdit::OnChar(nChar, nRepCnt, nFlags); }
/* ================ CSyntaxRichEditCtrl::ReplaceAll ================ */ int CSyntaxRichEditCtrl::ReplaceAll( const char *find, const char *replace, bool matchCase, bool matchWholeWords ) { long selStart, selEnd, flags, search, length, start; int numReplaced; tom::ITextRange *range; CComBSTR bstr( find ); if ( find[0] == '\0' ) { return 0; } m_TextDoc->Freeze( NULL ); GetSel( selStart, selEnd ); flags = 0; flags |= matchCase ? tom::tomMatchCase : 0; flags |= matchWholeWords ? tom::tomMatchWord : 0; m_TextDoc->Range( 0, GetTextLength(), &range ); search = GetTextLength(); numReplaced = 0; while( range->FindShit( bstr, search, flags, &length ) == S_OK ) { range->get_Start( &start ); ReplaceText( start, start + length, replace ); numReplaced++; } range->Release(); m_TextDoc->Unfreeze( NULL ); return numReplaced; }
// Enable or disable the secure mode, default is enabled void CSecureEditEx::EnableSecureMode(BOOL bEnable) { if(m_bSecMode == bEnable) return; // Nothing to do LPTSTR lpSource = GetPassword(); ASSERT(lpSource != NULL); ASSERT((int)_tcslen(lpSource) == m_nOldLen); const int iPos = static_cast<int>(GetSel() & 0xFFFF); _DeleteAll(); m_bSecMode = bEnable; if(lpSource != NULL) { m_nOldLen = (int)_tcslen(lpSource); if(bEnable == FALSE) SetWindowText(lpSource); else { if(m_nOldLen != 0) { _InsertCharacters(0, lpSource, (unsigned int)m_nOldLen); _tcsset_s(lpSource, m_nOldLen + 1, TCH_STDPWCHAR); } SetWindowText(lpSource); } if((iPos >= 0) && (iPos <= m_nOldLen)) SetSel(iPos, iPos, FALSE); else { ASSERT(FALSE); } } DeletePassword(lpSource); lpSource = NULL; }
void CAutoRichEditCtrl::SetSelectionBold() { long start=0, end=0; GetSel(start, end); // Get the current selection SetCharStyle(CFM_BOLD, CFE_BOLD, start, end); // Make it bold }
void CTitleTimeEdit::KeyInNumeric(UINT nChar) { int nCharPos = CharFromPos(GetCaretPos()); int nSelStart = 0; int nSelEnd = 0; GetSel(nSelStart, nSelEnd); if(nSelStart == nSelEnd) { if(nCharPos < 12) { if((s_szDefTMChar[nCharPos] == '0') &&(nChar <= (UINT)s_szMaxTMChar[nCharPos])) { m_szTimeChar[nCharPos] = nChar; } nCharPos ++; if(s_szDefTMChar[nCharPos] != '0') nCharPos ++; } } else { if((s_szDefTMChar[nSelStart] == '0') &&(nChar <= (UINT)s_szMaxTMChar[nCharPos])) { m_szTimeChar[nSelStart] = nChar; } } Update(); SetSel(nCharPos, nCharPos); }
void CAutoRichEditCtrl::SetSelectionItalic() { long start=0, end=0; GetSel(start, end); SetCharStyle(CFM_ITALIC, CFE_ITALIC, start, end); }
LRESULT COXMaskedEdit::OnClear(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); if(m_listData.GetCount()==0 || GetStyle()&ES_READONLY) { return CEdit::Default(); } int nSelectionStart=0; int nSelectionEnd=0; GetSel(nSelectionStart, nSelectionEnd); // Before updating, let the control do its normal thing. CEdit::Default(); // First do our version of the cut. int nDeleteCount=DeleteRange(nSelectionStart, nSelectionEnd); // Now we update with our standard mask. Update(nSelectionStart); if(nDeleteCount==0) { // I don't think we want to beep if no input characters were cut. //ValidationError(); } return 0; }
void CAutoRichEditCtrl::SetSelectionUnderlined() { long start=0, end=0; GetSel(start, end); SetCharStyle(CFM_UNDERLINE, CFE_UNDERLINE, start, end); }