当前位置: 首页>>代码示例>>C++>>正文


C++ ReplaceSel函数代码示例

本文整理汇总了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;
}
开发者ID:localvar,项目名称:backup,代码行数:60,代码来源:EditView.cpp

示例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 ();
}
开发者ID:shuride,项目名称:macro-windows,代码行数:32,代码来源:EditLogB.cpp

示例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);
        }
    }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:31,代码来源:native_textfield_win.cpp

示例4: ReplaceSel

//删除字符
VOID CSkinRichEdit::OnDeleteString()
{
	//删除字符
	ReplaceSel(TEXT(""));

	return;
}
开发者ID:codercold,项目名称:whgame,代码行数:8,代码来源:SkinRichEdit.cpp

示例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);
}
开发者ID:killbug2004,项目名称:remotecontrol,代码行数:28,代码来源:HistoryEdit.cpp

示例6: ReplaceSel

CRichEditCtrlX& CRichEditCtrlX::operator<<(UINT uVal)
{
	CString strVal;
	strVal.Format(_T("%u"), uVal);
	ReplaceSel(strVal);
	return *this;
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:7,代码来源:RichEditCtrlX.cpp

示例7: LineIndex

/////////////////////////////////////////////////////////////////////////////
// 清除指定行
/////////////////////////////////////////////////////////////////////////////
void COutputCtrl::ClearLineFrom(INT dlineFrom, INT dlineTo)
{
	int Num1 = LineIndex(dlineFrom);
	int Num2 = LineIndex(dlineTo+1);
	SetSel(Num1,Num2);
	ReplaceSel("");
}
开发者ID:GFFavourite,项目名称:Script.NET,代码行数:10,代码来源:OutputCtrl.cpp

示例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 );
}
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:46,代码来源:ZdCtlMLE.cpp

示例9: SetSel

//清除屏幕
bool CSkinRichEdit::CleanScreen()
{
	//清除屏幕
	SetSel(0,GetWindowTextLength());
	ReplaceSel(TEXT(""));

	return true;
}
开发者ID:codercold,项目名称:whgame,代码行数:9,代码来源:SkinRichEdit.cpp

示例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));
	}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:9,代码来源:TWScriptEdit.cpp

示例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);
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:9,代码来源:TWScriptEdit.cpp

示例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;
}
开发者ID:kevinzhwl,项目名称:easyMuleVeryCD,代码行数:54,代码来源:HTRichEditCtrl.cpp

示例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;
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:12,代码来源:RichEdit.cpp

示例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);
    }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:13,代码来源:native_textfield_win.cpp

示例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 );
}
开发者ID:diduoren,项目名称:youeryuan,代码行数:24,代码来源:ConsoleEdit.cpp


注:本文中的ReplaceSel函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。