本文整理汇总了C++中ReplaceSel函数的典型用法代码示例。如果您正苦于以下问题:C++ ReplaceSel函数的具体用法?C++ ReplaceSel怎么用?C++ ReplaceSel使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReplaceSel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ATLASSERT
LRESULT CScriptEditView::OnFindReplaceCmd( UINT, WPARAM, LPARAM lParam, BOOL& )
{
CFindReplaceDialog* pDlg = CFindReplaceDialog::GetNotifier(lParam);
if( pDlg == NULL )
{
::MessageBeep( (UINT)-1 );
return 1;
}
ATLASSERT( pDlg == m_pFindDlg );
if( pDlg->IsTerminating() )
{
m_pFindDlg = NULL;
return 0;
}
lstrcpyn( m_fro.StrToFind, pDlg->m_fr.lpstrFindWhat, DIMOF(m_fro.StrToFind) );
m_fro.bMatchCase = (pDlg->MatchCase() != FALSE);
m_fro.bWholeWord = (pDlg->MatchWholeWord() != FALSE);
if( pDlg->FindNext() )
{
if( !DoFindText() )
::MessageBeep( (UINT)-1 );
}
else if( pDlg->ReplaceCurrent() )
{
long nStart, nEnd;
GetSel( nStart, nEnd );
if( nStart != nEnd )
{
LPTSTR szFind = (LPTSTR)_alloca( (nEnd - nStart + 1) * sizeof(TCHAR) );
GetSelText( szFind );
int nRet;
if( m_fro.bMatchCase )
nRet = lstrcmp( szFind, m_fro.StrToFind );
else
nRet = lstrcmpi( szFind, m_fro.StrToFind );
if(nRet == 0)
ReplaceSel( pDlg->GetReplaceString(), TRUE );
}
if( !DoFindText() )
::MessageBeep( (UINT)-1 );
}
else if( pDlg->ReplaceAll() )
{
SetRedraw(FALSE);
CWaitCursor wait;
while( DoFindText(false) )
ReplaceSel( pDlg->GetReplaceString(), TRUE );
SetRedraw( TRUE );
Invalidate();
UpdateWindow();
}
return 0;
}
示例2: SetLimitText
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 ();
}
示例3: collapsed
void NativeTextfieldWin::OnPaste()
{
if(textfield_->read_only() || !ViewDelegate::view_delegate)
{
return;
}
ui::Clipboard* clipboard = ViewDelegate::view_delegate->GetClipboard();
if(!clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(),
ui::Clipboard::BUFFER_STANDARD))
{
return;
}
std::wstring clipboard_str;
clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_str);
if(!clipboard_str.empty())
{
std::wstring collapsed(CollapseWhitespace(clipboard_str, false));
if(textfield_->style() & Textfield::STYLE_LOWERCASE)
{
collapsed = base::i18n::ToLower(collapsed);
}
// Force a Paste operation to trigger ContentsChanged, even if identical
// contents are pasted into the text box. See http://crbug.com/79002
ReplaceSel(L"", false);
textfield_->SyncText();
text_before_change_.clear();
ReplaceSel(collapsed.c_str(), true);
}
}
示例4: ReplaceSel
//删除字符
VOID CSkinRichEdit::OnDeleteString()
{
//删除字符
ReplaceSel(TEXT(""));
return;
}
示例5: GetLocalTime
void CHistoryEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CString newchar = (TCHAR)nChar;
if (nChar=='\r')
{
int n = m_cmdList.GetCount()-LASTCMDSIZE;
if (n>0)
{
m_cmdList.RemoveHead();// remember last 10 commands
}
CString strTmp = m_strCmd, date;
SYSTEMTIME st;
GetLocalTime(&st);
date.Format("\r\n%04d-%02d-%02d %02d:%02d:%02d:%03d, #",st.wYear,st.wMonth,st.wDay,
st.wHour,st.wMinute,st.wSecond,st.wMilliseconds);
m_strCmd.Empty();
::SendMessage(GetParent()->m_hWnd, WM_DADA_SENDCMDMSG, (WPARAM)WM_MY_SENDCOMMAND, (LPARAM)(LPCTSTR)strTmp);
m_cmdList.AddTail(strTmp);
newchar = date;
}
else
{
m_strCmd += newchar;
}
int nLength = SendMessage(WM_GETTEXTLENGTH);
SetSel(nLength, nLength);
ReplaceSel(newchar);
}
示例6: ReplaceSel
CRichEditCtrlX& CRichEditCtrlX::operator<<(UINT uVal)
{
CString strVal;
strVal.Format(_T("%u"), uVal);
ReplaceSel(strVal);
return *this;
}
示例7: LineIndex
/////////////////////////////////////////////////////////////////////////////
// 清除指定行
/////////////////////////////////////////////////////////////////////////////
void COutputCtrl::ClearLineFrom(INT dlineFrom, INT dlineTo)
{
int Num1 = LineIndex(dlineFrom);
int Num2 = LineIndex(dlineTo+1);
SetSel(Num1,Num2);
ReplaceSel("");
}
示例8: TraceLineS
zBOOL
ZMLE::HandleQuickKey( zACCEL_DEF ad )
{
#ifdef DEBUG_ALL
TraceLineS( "ZMLE::HandleQuickKey: ", *m_pzsTag );
#endif
if ( ad.uVK == VK_TAB && ad.fAlt == 0 && ad.fCtrl == 1 )
{
ReplaceSel( "\t", TRUE );
return( TRUE );
}
else
if ( ad.uVK == VK_TAB && ad.fAlt == 0 && ad.fCtrl == 0 )
{
ZMapAct *pzma = m_pZSubtask->
GetFocusCtrlWithinComposite( 0, this, !ad.fShift );
if ( pzma && pzma->m_pCtrl && mIs_hWnd( pzma->m_pCtrl->m_hWnd ) )
{
pzma->m_pCtrl->SetFocus( );
}
return( TRUE );
}
else
if ( ad.uVK == VK_RETURN )
{
if ( ad.fAlt == 0 )
{
ReplaceSel( "\r\n", TRUE );
}
else
if ( ad.fAlt &&
m_pZSubtask->m_pCurrDfltBtn &&
m_pZSubtask->m_pCurrDfltBtn->m_pCtrl &&
mIs_hWnd( m_pZSubtask->m_pCurrDfltBtn->m_pCtrl->m_hWnd ) )
{
m_pZSubtask->m_pCurrDfltBtn->m_pCtrl->SendMessage( WM_LBUTTONDOWN );
m_pZSubtask->m_pCurrDfltBtn->m_pCtrl->SendMessage( WM_LBUTTONUP );
}
return( TRUE );
}
return( FALSE );
}
示例9: SetSel
//清除屏幕
bool CSkinRichEdit::CleanScreen()
{
//清除屏幕
SetSel(0,GetWindowTextLength());
ReplaceSel(TEXT(""));
return true;
}
示例10: ASSERT
void CTWScriptEdit::ChangeCase(int nStart, int nEnd, LPCWSTR lpsz)
{
ASSERT((nEnd - nStart) == (int)_tcslen(lpsz));
if (!m_bCaseSensitive && m_bChangeCase) {
SetSel(nStart, nEnd);
ReplaceSel(GetMBCS(lpsz));
}
}
示例11: ReplaceSel
void CTWScriptEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == '\t' && GetKeyState(VK_CONTROL) >= 0) {
ReplaceSel("\t");
return;
}
CRichEditCtrl::OnChar(nChar, nRepCnt, nFlags);
}
示例12: SetSel
void CHTRichEditCtrl::AddString(int nPos, LPCTSTR pszString, bool bLink, COLORREF cr,COLORREF bk, DWORD mask)
{
bool bRestoreFormat = false;
m_bEnErrSpace = false;
SetSel(nPos, nPos);
if (bLink)
{
CHARFORMAT2 cf;
memset(&cf, 0, sizeof cf);
GetSelectionCharFormat(cf);
cf.dwMask |= CFM_LINK;
cf.dwEffects |= CFE_LINK;
SetSelectionCharFormat(cf);
}
else if (cr != CLR_DEFAULT || bk != CLR_DEFAULT)
{
CHARFORMAT2 cf;
memset(&cf, 0, sizeof(cf));
GetSelectionCharFormat(cf);
if(cr != CLR_DEFAULT)
{
cf.dwMask |= CFM_COLOR;
cf.dwEffects &= ~CFE_AUTOCOLOR;
cf.crTextColor = cr;
}
if(bk != CLR_DEFAULT)
{
cf.dwMask |= CFM_BACKCOLOR;
cf.dwEffects &= ~CFE_AUTOBACKCOLOR;
cf.crBackColor = bk;
}
cf.dwMask |= mask;
if(mask & CFM_BOLD)
cf.dwEffects |= CFE_BOLD; //Checks if bold is set in the mask and then sets it in effects if it is
else if(cf.dwEffects & CFE_BOLD)
cf.dwEffects ^= CFE_BOLD; //Unset bold
if(mask & CFM_ITALIC)
cf.dwEffects |= CFE_ITALIC; //Checks if italic is set in the mask and then sets it in effects if it is
else if(cf.dwEffects & CFE_ITALIC)
cf.dwEffects ^= CFE_ITALIC; //Unset bold
if(mask & CFM_UNDERLINE)
cf.dwEffects |= CFE_UNDERLINE; //Checks if underlined is set in the mask and then sets it in effects if it is
else if(cf.dwEffects & CFE_UNDERLINE)
cf.dwEffects ^= CFE_UNDERLINE; //Unset italic
SetSelectionCharFormat(cf);
bRestoreFormat = true;
}
else if (m_bRestoreFormat)
{
SetSelectionCharFormat(m_cfDefault);
}
ReplaceSel(pszString);
m_bRestoreFormat = bRestoreFormat;
}
示例13: GetSel
int RichEdit::Replace(int start, int end, const TCHAR *new_text)
{
CHARRANGE sel = GetSel();
CHARRANGE replace_sel = { start, end };
SetSel(replace_sel);
ReplaceSel(new_text);
int dif = FixSel(&sel, replace_sel, mir_tstrlen(new_text));
SetSel(sel);
return dif;
}
示例14: OnCopy
void NativeTextfieldWin::OnCut()
{
if(textfield_->read_only() || textfield_->IsPassword())
{
return;
}
OnCopy();
// This replace selection will have no effect (even on the undo stack) if the
// current selection is empty.
ReplaceSel(L"", true);
}
示例15: SetSel
// 增加字符
// CEdit显示内容有限制,当超过该限制时,需要删除原来的内容,再增加内容
void CConsoleEdit::AddTexts(const char* str, int len)
{
if(len == -1) len = strlen(str);
//KDebug("%d %d", m_nLength, len);
if ((m_nLength + len) > MAX_DATA_NUM)
{
SetSel(0, len + 128, TRUE);
ReplaceSel("");
if (len > MAX_DATA_NUM)
{
CString result(str);
result = result.Right(MAX_DATA_NUM);
ReplaceSel(result);
return;
}
}
MoveToEnd();
ReplaceSel(str);
if (strcmp(str,m_pretitle)==0)
m_last_title_pos = SendMessage( WM_GETTEXTLENGTH );
}