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


C++ GetTextLength函数代码示例

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


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


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