• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetTextLength函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetTextLength函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTextLength函数的具体用法?C++ GetTextLength怎么用?C++ GetTextLength使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: GetPage

bool GUI_TextField::HandleEvent(const char *action)
{
    if (!strcmp(action, "accept")) {
        GUI_Page *page = GetPage();
        if (page) {
            page->UpdateFocusWidget(1);
            page->DecRef();
        }
        return true;
    } else
    if (!strcmp(action, "prev")) {
        SetCursorPos(GetCursorPos() - 1);
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "next")) {
        SetCursorPos(GetCursorPos() + 1);
        InputDigit(-1);
        return true;
    } else
    if ((GetFlags() & WIDGET_FOCUSED &&
         (!strcmp(action, "stop") ||
          !strcmp(action, "cancel"))) ||
        !strcmp(action, "clear") ||
        !strcmp(action, "backspace")) {
        Backspace();
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "delete")) {
        DeleteCurrChar();
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "home") ||
        !strcmp(action, "first")) {
        SetCursorPos(0);
        InputDigit(-1);
        return true;
    } else
    if (!strcmp(action, "end") ||
        !strcmp(action, "last")) {
        SetCursorPos(GetTextLength());
        InputDigit(-1);
        return true;
    } else
    if (!strncmp(action, "key", 3) &&
        strlen(action) == 4) {
        SendChar(action[3], true);
        InputDigit(-1);
        return true;
    } else
    if (!strncmp(action, "number", 6) &&
        strlen(action) == 7 &&
        isdigit(action[6])) {
        InputDigit(atoi(action + 6));
        return true;
    }
    return GUI_Widget::HandleEvent(action);
}
开发者ID:vseryakov,项目名称:lmbox,代码行数:60,代码来源:textfield.cpp


示例2: Write

	//----------------------------------------------------------------------------
	void Write(Real x, Real y, Real z, unsigned int color,
		const char *text, int count, FONT_ALIGN mode)
	{
		if (!mInitialized)
			return;
		auto& renderer = Renderer::GetInstance();
		if (renderer.GetRendererOptions()->r_noText)
			return;

		//
		if (count < 0)
			count = GetTextLength(text);

		if (mode == FONT_ALIGN_CENTER)
		{
			Real w = GetTextWidth(text, count);
			x -= w / 2;
		}
		else if (mode == FONT_ALIGN_RIGHT)
		{
			Real w = GetTextWidth(text, count);
			x -= w;
		}

		mColor = color;

		renderer.UpdateObjectConstantsBuffer(&mObjectConstants);

		InternalWrite(Round(x), Round(y), z, text, count);
	}
开发者ID:fastbird,项目名称:fastbirdEngine_NewAPI,代码行数:31,代码来源:Font.cpp


示例3: GetSel

/*
================
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);
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:35,代码来源:CSyntaxRichEditCtrl.cpp


示例4: Key_GetWord

void Key_GetWord(uint8 KeyValue,char *D,uint8 InType)
{
  uint8 Index,Length;
	char CodeBuf[200],*Data=D;
	BufferFill(&CodeBuf[0],0,sizeof(CodeBuf));
	if(InType&IT_Dot)StringEndingAppend(".",&CodeBuf[0]);
	if(InType&IT_Minus)StringEndingAppend("-",&CodeBuf[0]);
	if(InType&IT_Num)StringEndingAppend("0123456789",&CodeBuf[0]);
	if(InType&IT_ASCIIS)StringEndingAppend("abcdefghijklmnopqrstuvwxyz",&CodeBuf[0]);
	if(InType&IT_ASCIIB)StringEndingAppend("ABCDEFGHIJKLMNOPQRSTUVWXYZ",&CodeBuf[0]);
	if(InType&IT_CurCLiB)StringEndingAppend((void *)(Tos_GetFontHandle()->P_CIndex),&CodeBuf[0]);
	Length=GetTextLength(&CodeBuf[0]);
	Length++;
	Index=Index_Word(CodeBuf,Data,Length);
	if(Index==0xff)Index=0;
	 if(KeyValue==Key_Up)
   {
		  if(CodeBuf[Index]<0x80)Index++;else Index+=2;if(Index>=Length)Index=0;
       if(CodeBuf[Index]<0x80){*Data=CodeBuf[Index];}else {*(uint16 *)Data=*(uint16 *)&CodeBuf[Index];}
	 }
	  if(KeyValue==Key_Down)
   {
		   if(CodeBuf[Index-2]<0x80)Index--;else Index-=2;if(Index==0xff)Index=(Length);
       if(CodeBuf[Index]<0x80){*Data=CodeBuf[Index];}else {*(uint16 *)Data=*(uint16 *)&CodeBuf[Index];} 
	 }
	 Index=Index_Word(CodeBuf,Data,Length);
	 if(Index==0xff)Index=0;
}
开发者ID:RTOS-Developers,项目名称:TRTOS,代码行数:28,代码来源:Menu_Base.c


示例5: Key_GetASCII

void Key_GetASCII(uint8 KeyValue,uint8 *Data,uint8 InType)
{
  uint8 Index,Length;
	char CodeBuf[200];
	BufferFill(&CodeBuf[0],0,sizeof(CodeBuf));
	if(InType&IT_Dot)StringEndingAppend(".",&CodeBuf[0]);
	if(InType&IT_Minus)StringEndingAppend("-",&CodeBuf[0]);
	if(InType&IT_Num)StringEndingAppend("0123456789",&CodeBuf[0]);
	if(InType&IT_ASCIIS)StringEndingAppend("abcdefghijklmnopqrstuvwxyz",&CodeBuf[0]);
	if(InType&IT_ASCIIB)StringEndingAppend("ABCDEFGHIJKLMNOPQRSTUVWXYZ",&CodeBuf[0]);
	if(InType&IT_CurCLiB)StringEndingAppend((void *)(Tos_GetFontHandle()->P_CIndex),&CodeBuf[0]);
	if(InType&IT_End)StringEndingAppend("\r\n",&CodeBuf[0]);
	StringEndingAppend("\n",&CodeBuf[0]);
	Length=GetTextLength(&CodeBuf[0]);
   if(KeyValue==Key_Up)
   {
       Index=Index_Uchar(CodeBuf,*Data);
				Index++;
       if(Index>=(Length-1))Index=0;       
       *Data=CodeBuf[Index];
	 }
	  if(KeyValue==Key_Down)
   {
       Index=Index_Uchar(CodeBuf,*Data);
		   if(Index==0)Index=(Length-1);
       Index--;
       *Data=CodeBuf[Index];
	 }
}
开发者ID:RTOS-Developers,项目名称:TRTOS,代码行数:29,代码来源:Menu_Base.c


示例6: CharFromPos

/*
================
CSyntaxRichEditCtrl::GetNameForMousePosition
================
*/
bool CSyntaxRichEditCtrl::GetNameForMousePosition(idStr &name) const
{
	int charIndex, startCharIndex, endCharIndex, type;
	idStr text;

	charIndex = CharFromPos(mousePoint);

	for (startCharIndex = charIndex; startCharIndex > 0; startCharIndex--) {
		GetText(text, startCharIndex - 1, startCharIndex);
		type = charType[text[0]];

		if (type != CT_NAME && type != CT_NUMBER) {
			break;
		}
	}

	for (endCharIndex = charIndex; endCharIndex < GetTextLength(); endCharIndex++) {
		GetText(text, endCharIndex, endCharIndex + 1);
		type = charType[text[0]];

		if (type != CT_NAME && type != CT_NUMBER) {
			break;
		}
	}

	GetText(name, startCharIndex, endCharIndex);

	return (endCharIndex > startCharIndex);
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:34,代码来源:CSyntaxRichEditCtrl.cpp


示例7: TRACEBEGIN

LONG CRchTxtPtr::GetCchLeftRunPF() 
{
	TRACEBEGIN(TRCSUBSYSBACK, TRCSCOPEINTERN, "CRchTxtPtr::GetCchLeftRunPF");

	return _rpPF.IsValid()
		? _rpPF.GetCchLeft() : GetTextLength() - GetCp();
}
开发者ID:achellies,项目名称:DUI_LIb,代码行数:7,代码来源:rtext.cpp


示例8: SetShift

void GUITextBox::OnKeyDown(UCHAR key)
{
	SetShift(keys[VK_SHIFT]);

	if(GetText())
	{
		if((IsAlpabetic(key) || key == VK_SPACE) &&
			GetTextLength() < GetMaxTextLength())
		{
			char* new_text = new char[strlen(GetText())+2];
			if(GetShift())
				sprintf(new_text, "%s%c\0", GetText(), key);
			else
				sprintf(new_text, "%s%c\0", GetText(), tolower(key));

			try
			{
				delete[] GetText();
			}
			catch(...)
			{
				WriteToLog("Exception in GUITextBox::OnKeyDown()");
			}
			SetText(new_text);
			SetTextLength(strlen(GetText()));
		}
		else if(key == VK_BACK)
		{
			UINT len = strlen(GetText());
			if(len > 0)
			{
				string s = string(GetText());
				char* new_text = new char[len];

				sprintf(new_text, "%s\0", s.substr(0, s.length()-1).c_str());
				

				try
				{
					delete[] GetText();
				}
				catch(...)
				{
					WriteToLog("Exception in GUITextBox::OnKeyDown()");
				}
				SetText(new_text);
				SetTextLength(strlen(GetText()));
			}
		}
	}
	else
	{
		char* new_text = new char[1];
		if(GetShift())
			new_text[0] = key;
		else
			new_text[0] = tolower(key);
		SetText(new_text);
	}
}
开发者ID:lightsgoout,项目名称:interview,代码行数:60,代码来源:gui_textbox.cpp


示例9: CreateFontIndirect

void CTextEditor::Render(HDC hdc, const LOGFONT *plf)
{
    HFONT hFont = CreateFontIndirect(plf);

    if (hFont)
    {
        HFONT hFontOrg = (HFONT)SelectObject(hdc, hFont);

        _layout.Layout(hdc, GetTextBuffer(), GetTextLength());
        _layout.Render(hdc, GetTextBuffer(), GetTextLength(), _nSelStart, _nSelEnd,
                       _nCompStart, _nCompEnd,
                       _prgAttr, _lAttr, _prgClauseInfo, _lClauseInfo);

        SelectObject(hdc, hFontOrg);
        DeleteObject(hFont);
    }
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:17,代码来源:TextEditor.cpp


示例10: COM_Menu_Load

/*******************************************************************************
Func:菜单项回传
Date:2016-3-25
Note:
*******************************************************************************/
uint8 COM_Menu_Load(uint8 Index,uint8 *Menu)
{
	uint8 Length;
	if(Index>=Menu_OptionLength(MenuList))return 0;
	MUI_GetOptionString((char *)Menu,&MenuList[Index]);
	Length=GetTextLength(Menu);
	return Length;
}
开发者ID:tongjingyu,项目名称:Prj,代码行数:13,代码来源:App_Sensor.c


示例11: SetCursorPos

int GUI_TextField::OnGotFocus(void)
{
    if (!GUI_Widget::OnGotFocus()) {
        return 0;
    }
    SetCursorPos(GetTextLength());
    return 1;
}
开发者ID:vseryakov,项目名称:lmbox,代码行数:8,代码来源:textfield.cpp


示例12: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
HTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
{
  NS_ENSURE_ARG_POINTER(aTextLength);
  *aTextLength = GetTextLength();

  return NS_OK;
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:8,代码来源:HTMLTextAreaElement.cpp


示例13: wxTmemcpy

bool wxTextDataObject::GetDataHere(void *buf) const
{
    // NOTE: use wxTmemcpy() instead of wxStrncpy() to allow
    //       retrieval of strings with embedded NULLs
    wxTmemcpy( (wxChar*)buf, GetText().c_str(), GetTextLength() );

    return true;
}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:8,代码来源:dobjcmn.cpp


示例14: ClientToScreen

//右键消息
VOID CRichEditTrace::OnRButtonDown(UINT nFlags, CPoint point)
{
	CMenu menu;
	ClientToScreen(&point);

	menu.CreatePopupMenu();

	CHARRANGE sl;
	GetSel(sl);
	menu.AppendMenu(MF_STRING | (sl.cpMax != sl.cpMin) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU0, "复制(&C)\tCtrl+C");
	menu.AppendMenu(MF_STRING | (GetTextLength() > 0 && sl.cpMax - sl.cpMin < GetTextLength()) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU1, "全选(&A)\tCtrl+A");
	menu.AppendMenu(MF_STRING | (false) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU2, "删除(&D)");
	menu.AppendMenu(MF_STRING | (GetTextLength() > 0) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU3, "清除信息");
	menu.AppendMenu(MF_SEPARATOR, 0);
	menu.AppendMenu(MF_STRING | (GetTextLength() > 0) ? 0 : MF_DISABLED | MF_GRAYED, IDM_MENU4, "保存信息...");

	TrackPopupMenu(menu.m_hMenu, nFlags, point.x, point.y, 0, m_hWnd, NULL);
}
开发者ID:Michael-Z,项目名称:qipai-game,代码行数:19,代码来源:TraceService.cpp


示例15: GetTextLength

int SciEdit::GetText(LPTSTR szText)
{
	if (szText == NULL)
		return 0;
	*szText = '\0';
	long lLen = GetTextLength();
	Call(SCI_GETTEXT, lLen+1, (LPARAM)szText);
	return lLen;
}
开发者ID:stievie,项目名称:Martis,代码行数:9,代码来源:SciEdit.cpp


示例16: FindDialog

bool SearchableEditor::find(bool newSearch)
{
    if (!fd)
        fd = new FindDialog(this, ::wxGetTopLevelParent(this));
    if (newSearch || findTextM.empty())
    {
        if (newSearch)
        {
            // find selected text
            wxString findText(GetSelectedText());
            // failing that initialize with the word at the caret
            if (findText.empty())
            {
                int pos = GetCurrentPos();
                int start = WordStartPosition(pos, true);
                int end = WordEndPosition(pos, true);
                if (end > start)
                    findText = GetTextRange(start, end);
            }
            fd->SetFindText(findText);
        }

        // do not re-center dialog if it is already visible
        if (!fd->IsShown())
            fd->Show();
        fd->SetFocus();
        return false;    // <- caller shouldn't care about this
    }

    int start = GetSelectionEnd();
    if (findFlagsM.has(se::FROM_TOP))
    {
        start = 0;
        findFlagsM.remove(se::ALERT);    // remove flag after first find
    }

    int end = GetTextLength();
    int p = FindText(start, end, findTextM, findFlagsM.asStc());
    if (p == -1)
    {
        if (findFlagsM.has(se::WRAP))
            p = FindText(0, end, findTextM, findFlagsM.asStc());
        if (p == -1)
        {
            if (findFlagsM.has(se::ALERT))
                wxMessageBox(_("No more matches"), _("Search complete"), wxICON_INFORMATION|wxOK);
            return false;
        }
    }
    centerCaret(true);
    GotoPos(p);
    GotoPos(p + findTextM.Length());
    SetSelectionStart(p);
    SetSelectionEnd(p + findTextM.Length());
    centerCaret(false);
    return true;
}
开发者ID:DragonZX,项目名称:flamerobin,代码行数:57,代码来源:FindDialog.cpp


示例17: TRACEBEGIN

/*
 *	CTxtEdit::GetClipboardData
 *
 *	@mfunc	return an data transfer object for the indicated
 *	range
 *
 *	@rdesc
 *		HRESULT				Success code.
 */
STDMETHODIMP CTxtEdit::GetClipboardData( 
	CHARRANGE *lpchrg, 			//@parm the range of text to use
	DWORD reco,					//@parm operation the data is for
	LPDATAOBJECT *lplpdataobj)	//@parm where to put the data object
{
	TRACEBEGIN(TRCSUBSYSOLE, TRCSCOPEEXTERN, "CTxtEdit::GetClipboardData");

	CCallMgr callmgr(this);
	HRESULT hr;
	LONG cpMin, cpMost;
	CLightDTEngine * pldte = GetDTE();

	//Make sure cpMin and cpMost are within the current text limits.
	//Interpret neg. value for cpMin as the beginning of the text,
	//and neg. value for cpMax as the end of the text.  If a char range
	//is not given use the current selection.
	if(lpchrg)
	{
		LONG cchText;

		cchText = (LONG)GetTextLength();

		cpMin = max(0, lpchrg->cpMin);
		cpMin = min(cchText, lpchrg->cpMin);
		cpMost = lpchrg->cpMost;
		if(lpchrg->cpMost < 0 || lpchrg->cpMost > cchText)
			cpMost = cchText;
	}
	else
	{
		CTxtSelection * psel = GetSel();

		psel->GetRange(cpMin, cpMost);
	}

	//Make sure this is a valid range.
	if(cpMin >= cpMost)
	{
		*lplpdataobj = NULL;
		return cpMin == cpMost
					? NOERROR
					: ResultFromScode(E_INVALIDARG);
	}

	CTxtRange rg(this, cpMin, cpMin-cpMost);

	//We don't use reco for anything.
	hr = pldte->RangeToDataObject(&rg, SF_RTF, lplpdataobj);

#ifdef DEBUG
	if(hr != NOERROR)
		TRACEERRSZSC("GetClipboardData", E_OUTOFMEMORY);
#endif

	return hr;
}
开发者ID:achellies,项目名称:DUI_LIb,代码行数:65,代码来源:object.cpp


示例18: DaCai_TextBox

void DaCai_TextBox(uint16 ScreenID,uint16 ControlID,char *fmt,...)
{
  va_list ap;
	char String[256];
	va_start(ap,fmt);
	vsprintf(String,fmt,ap);
	DaCai_SetTextBox(ScreenID,ControlID,(uint8 *)String,GetTextLength(String));
	va_end(ap);
	
}
开发者ID:tongjingyu,项目名称:Prj,代码行数:10,代码来源:DaCai_Driver.c


示例19: DaCai_Printf

void DaCai_Printf(char *fmt,...)
{
  va_list ap;
	char String[256];
	va_start(ap,fmt);
	vsprintf(String,fmt,ap);
	DaCai_SetTextBox(0x00,0x11,(uint8 *)String,GetTextLength(String));
	va_end(ap);
	
}
开发者ID:tongjingyu,项目名称:Prj,代码行数:10,代码来源:DaCai_Driver.c


示例20: GetTextLength

void CTextEditor::MoveSelectionNext()
{
    UINT nTextLength = GetTextLength();
    if (_nSelEnd < nTextLength)
       _nSelEnd++;

    _nSelStart = _nSelEnd;
    _pTextStore->OnSelectionChange();

}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:10,代码来源:TextEditor.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetTextPeer函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTextColor函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap