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


C++ CEdit::GetLine方法代码示例

本文整理汇总了C++中CEdit::GetLine方法的典型用法代码示例。如果您正苦于以下问题:C++ CEdit::GetLine方法的具体用法?C++ CEdit::GetLine怎么用?C++ CEdit::GetLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CEdit的用法示例。


在下文中一共展示了CEdit::GetLine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetEditText

CString CozyKnightModifyDlg::GetEditText(const CEdit& editCtrl)
{
    int nLenght = editCtrl.LineLength(1);
    CString strValue;
    editCtrl.GetLine(1, strValue.GetBuffer(nLenght), nLenght);
    strValue.ReleaseBuffer(nLenght);
    return strValue;
}
开发者ID:MaxTan,项目名称:cozy,代码行数:8,代码来源:CozyKnightModifyDlg.cpp

示例2:

// TODO: factor this code
static	void concatEdit2Lines(CEdit &edit)
{
	const	uint lineLen= 1000;
	uint	n;
	// retrieve the 2 lines.
	char	tmp0[2*lineLen];
	char	tmp1[lineLen];
	n= edit.GetLine(0, tmp0, lineLen);	tmp0[n]= 0;
	n= edit.GetLine(1, tmp1, lineLen);	tmp1[n]= 0;
	// concat and update the CEdit.
	edit.SetWindowText(strcat(tmp0, tmp1));
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:13,代码来源:located_bindable_dialog.cpp

示例3: GetCDInfo

/**
 * Gets change directory info from previous lines, feature only 
 * for cmdl and compiler tab, all other tabs return sFile unchanged.
 *
 * @param           iLine: zero based line index from where to 
 *                  search cd [path] commands backward until
 *                  first line or cd <fullpath> or special cd $(prjdir) 
 *                  is found
 * @param           editCtrl: holds the text data
 * @param           sFile: in/out. gets updated to point to final path
 * @param  (HACK)   pMsgFrame: CMsgFrame, used to check if cmdl, compiler tab
 * @param  (HACK)   pDoc:      CMsgDoc, used to check if cmdl, compiler tab
 *                  may still be a (project) relative path on exit.
 * @see             -
*/
static void GetCDInfo(int iLine, CEdit& editCtrl, CString& sFile, CMsgFrame* pMsgFrame, CMsgDoc* pDoc)
{
    int          nLen;
    const TCHAR* pszDir;
    TCHAR        buffer[2*MAX_PATH];


    if(FC_StringIsAbsPath(sFile))
        return;
    if(iLine >= editCtrl.GetLineCount())
        return;

    //feature only for compiler tab (HACK):
    ASSERT (pMsgFrame != NULL);
    if (!pMsgFrame)
        return;
    int iIndex=-1;
    pMsgFrame->m_tabWnd.GetActiveTab(iIndex);
    if(!pDoc  || iIndex<0 || iIndex >= pDoc->m_arrMsgData.GetSize())
    {
        ASSERT (!"bad pDoc, iIndex");
        return;
    }
    MSG_VIEWER_TYPE msgTyp = pDoc->m_arrMsgData[iIndex].m_MsgViewerType;
    if(msgTyp != MSG_CmdLineMsgViewer && msgTyp != MSG_CompileMsgViewer)
        return;


    while(iLine>=0)
    {
        nLen = editCtrl.GetLine(iLine, buffer, FC_ARRAY_LEN(buffer)-10);
        iLine--;
        if(nLen<=0)
            continue;
        buffer[nLen] = 0;//<-needed ?
        FC_StringTrim(buffer);
        if((pszDir = IsLineCDInfo(buffer)) != NULL)
        {
            if(!*pszDir)
                break;//cd $(prjdir): don't prepend default prj dir as an abs path to sFile

            //all other rel or abs cd commands must be prepended:
            sFile.Insert(0, '\\');
            sFile.Insert(0, pszDir);
            //if is abs must stop here:
            if(FC_StringIsAbsPath(pszDir))
                break; 
        }
    }
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:65,代码来源:msgview.cpp

示例4: atoi

void
mfc_goto::OnOK()
{
  CEdit *ce = (CEdit *)GetDlgItem(IDC_GOTO_LINE);
  char line[16];
  int n = ce->GetLine(0, line, 12);
  if (n>0) {
    line[n] = '\0';
    n = atoi(line)-1;
    if (n < 0) n = 0;
    n = view->GetRichEditCtrl().LineIndex(n);
    view->GetRichEditCtrl().SetSel(n,n);
  }
  CDialog::OnOK();
}
开发者ID:mbentz80,项目名称:jzigbeercp,代码行数:15,代码来源:mfcterm.cpp

示例5: PyWinObject_FromTCHAR

// @pymethod int|PyCEdit|GetLine|Returns the text in a specified line.
static PyObject *
PyCEdit_get_line(PyObject *self, PyObject *args)
{
	CEdit *pEdit = GetEditCtrl(self);
	if (!pEdit)
		return NULL;
	GUI_BGN_SAVE;
	int lineNo = pEdit->LineFromChar();
	GUI_END_SAVE;
	// @pyparm int|lineNo|current|Contains the zero-based index value for the desired line.
	// @comm This function is not an MFC wrapper.
	if (!PyArg_ParseTuple(args, "|i:GetLine", &lineNo))
		return NULL;
	int size = 1024;	// ahhhhh-this fails with 128, even when line len==4!
					// god damn it - try and write a fairly efficient normal case,
					// and handle worst case, and look what happens!
	CString csBuffer;			// use dynamic mem for buffer
	TCHAR *buf;
	int bytesCopied;
	// this TRACE _always_ returns the length of the first line - hence the
	// convaluted code below.
//	TRACE("LineLength for line %d is %d\n", lineNo, pView->GetEditCtrl().LineLength(lineNo));
	// loop if buffer too small, increasing each time.
	while (size<0x7FFF)			// reasonable line size max? - maxuint on 16 bit.
	{
		buf = csBuffer.GetBufferSetLength(size);
		if (buf==NULL)
			RETURN_ERR("Out of memory getting Edit control line value");

		GUI_BGN_SAVE;
		bytesCopied = pEdit->GetLine(lineNo, buf, size);
		GUI_END_SAVE;
		if (bytesCopied!=size)	// ok - get out.
			break;
		// buffer too small
		size += size;	// try doubling!
		TRACE0("Doubling buffer for GetLine value\n");
	}
	if (bytesCopied==size)	// hit max.
		--bytesCopied;	// so NULL doesnt overshoot.
	if (buf[bytesCopied-1]=='\r' || buf[bytesCopied-1]=='\n')	// kill newlines.
		--bytesCopied;
	buf[bytesCopied] = '\0';
	return PyWinObject_FromTCHAR(buf);
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:46,代码来源:win32ctledit.cpp

示例6: showlog

void CLogView::showlog(WPARAM wParam, LPARAM lParam)
{
	UINT nlength = (UINT)wParam;
	CString log =(char*)lParam;
	char tmpstr[100];
	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
	UpdateData(TRUE);
	m_log+=log;
	if (m_log.GetLength()>2048)
	{
		m_log = m_log.Right(1024);//先去掉512字节
		UpdateData(FALSE);
		pEdit->GetLine(0,tmpstr,100);
		int nlength = strlen(tmpstr); //得到可能乱码的长度
		m_log = m_log.Right(1024-nlength);//去掉nlength长度
	}
	UpdateData(FALSE);
	
	
	pEdit->LineScroll(pEdit->GetLineCount(),0);
	delete (char*)lParam;
	lParam =NULL;
}
开发者ID:BoonieBear,项目名称:7000m,代码行数:23,代码来源:LogView.cpp


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