这篇教程C++ GetTextLength函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetTextLength函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTextLength函数的具体用法?C++ GetTextLength怎么用?C++ GetTextLength使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetTextLength函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetPagebool 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,
示例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,
示例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,
示例4: Key_GetWordvoid 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,
示例5: Key_GetASCIIvoid 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,
示例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,
示例7: TRACEBEGINLONG CRchTxtPtr::GetCchLeftRunPF() { TRACEBEGIN(TRCSUBSYSBACK, TRCSCOPEINTERN, "CRchTxtPtr::GetCchLeftRunPF"); return _rpPF.IsValid() ? _rpPF.GetCchLeft() : GetTextLength() - GetCp();}
开发者ID:achellies,项目名称:DUI_LIb,代码行数:7,
示例8: SetShiftvoid 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,
示例9: CreateFontIndirectvoid 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,
示例10: COM_Menu_Load/*******************************************************************************Func:菜单项回传Date:2016-3-25Note:*******************************************************************************/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,
示例11: SetCursorPosint GUI_TextField::OnGotFocus(void){ if (!GUI_Widget::OnGotFocus()) { return 0; } SetCursorPos(GetTextLength()); return 1;}
开发者ID:vseryakov,项目名称:lmbox,代码行数:8,
示例12: NS_ENSURE_ARG_POINTERNS_IMETHODIMPHTMLTextAreaElement::GetTextLength(int32_t *aTextLength){ NS_ENSURE_ARG_POINTER(aTextLength); *aTextLength = GetTextLength(); return NS_OK;}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:8,
示例13: wxTmemcpybool 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,
示例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,
示例15: GetTextLengthint 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,
示例16: FindDialogbool 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,
示例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,
示例18: DaCai_TextBoxvoid 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,
示例19: DaCai_Printfvoid 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,
示例20: GetTextLengthvoid CTextEditor::MoveSelectionNext(){ UINT nTextLength = GetTextLength(); if (_nSelEnd < nTextLength) _nSelEnd++; _nSelStart = _nSelEnd; _pTextStore->OnSelectionChange();}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:10,
示例21: SetRedrawvoid CFulEditCtrl::ScrollToEnd() { SetRedraw(FALSE); SetSel(0, 0); ScrollCaret(); int l = GetTextLength(); SetSel(l, l); SendMessage(EM_SCROLLCARET, 0, 0); SetRedraw(TRUE); Invalidate();}
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:10,
示例22: GetTextWidth //---------------------------------------------------------------------------- Real GetTextWidth(const char *text, int count = -1, Real *outMinY = 0, Real *outMaxY = 0) { if (count < 0) count = GetTextLength(text); Real x = 0; Real minY = 10000; Real maxY = -10000; for (int n = 0; n < count;) { TextTags::Enum tag; int imgLen; int skiplen = SkipTags(&text[n], &tag, &imgLen); if (skiplen>0) { if (tag == TextTags::Img) { x += imgLen; } do { n += skiplen; skiplen = SkipTags(&text[n], &tag, &imgLen); if (tag == TextTags::Img) { x += imgLen; } } while (skiplen > 0); } if (n >= count) break; int charId = GetTextChar(text, n, &n); SCharDescr *ch = GetChar(charId); if (ch == 0) ch = &mDefChar; x += mScale * (ch->xAdv); Real h = mScale * Real(ch->srcH); Real y = mScale * (Real(mBase) - Real(ch->yOff)); if (minY > y - h) minY = y - h; if (maxY < y) maxY = y; if (n < count) x += AdjustForKerningPairs(charId, GetTextChar(text, n)); } if (outMinY) *outMinY = minY; if (outMaxY) *outMaxY = maxY; return x; }
开发者ID:fastbird,项目名称:fastbirdEngine_NewAPI,代码行数:56,
示例23: SetContainsMouse void NativeTextfieldWin::OnMouseMove(UINT keys, const gfx::Point& point) { SetContainsMouse(true); // Clamp the selection to the visible text so the user can't drag to select // the "phantom newline". In theory we could achieve this by clipping the X // coordinate, but in practice the edit seems to behave nondeterministically // with similar sequences of clipped input coordinates fed to it. Maybe it's // reading the mouse cursor position directly? // // This solution has a minor visual flaw, however: if there's a visible // cursor at the edge of the text (only true when there's no selection), // dragging the mouse around outside that edge repaints the cursor on every // WM_MOUSEMOVE instead of allowing it to blink normally. To fix this, we // special-case this exact case and discard the WM_MOUSEMOVE messages instead // of passing them along. // // But even this solution has a flaw! (Argh.) In the case where the user // has a selection that starts at the edge of the edit, and proceeds to the // middle of the edit, and the user is dragging back past the start edge to // remove the selection, there's a redraw problem where the change between // having the last few bits of text still selected and having nothing // selected can be slow to repaint (which feels noticeably strange). This // occurs if you only let the edit receive a single WM_MOUSEMOVE past the // edge of the text. I think on each WM_MOUSEMOVE the edit is repainting its // previous state, then updating its internal variables to the new state but // not repainting. To fix this, we allow one more WM_MOUSEMOVE through after // the selection has supposedly been shrunk to nothing; this makes the edit // redraw the selection quickly so it feels smooth. CHARRANGE selection; GetSel(selection); const bool possibly_can_discard_mousemove = (selection.cpMin==selection.cpMax) && (((selection.cpMin==0) && (ClipXCoordToVisibleText(point.x(), false)>point.x())) || ((selection.cpMin==GetTextLength()) && (ClipXCoordToVisibleText(point.x(), false)<point.x()))); if(!can_discard_mousemove_ || !possibly_can_discard_mousemove) { can_discard_mousemove_ = possibly_can_discard_mousemove; ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); // Force the Y coordinate to the center of the clip rect. The edit // behaves strangely when the cursor is dragged vertically: if the cursor // is in the middle of the text, drags inside the clip rect do nothing, // and drags outside the clip rect act as if the cursor jumped to the // left edge of the text. When the cursor is at the right edge, drags of // just a few pixels vertically end up selecting the "phantom newline"... // sometimes. RECT r; GetRect(&r); DefWindowProc(WM_MOUSEMOVE, keys, MAKELPARAM(point.x(), (r.bottom-r.top)/2)); OnAfterPossibleChange(true); } }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:54,
示例24: GetTextLengthvoid CTextEditor::MoveSelectionNext(){ UINT nTextLength = GetTextLength(); if (_nSelEnd < nTextLength) _nSelEnd++; _nSelStart = _nSelEnd; SetCompositionForm(); FlushCompositionString();}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:11,
示例25: _LockDocumentHRESULT touchmind::control::DWriteEditControlTextStoreACP::MoveACPToEnd() { if (_IsLocked(TS_LF_READ)) { return S_OK; } _LockDocument(TS_LF_READWRITE); LONG textLength = static_cast<LONG>(GetTextLength()); HRESULT hr = ChangeACPWithoutLock(textLength, textLength, TS_AE_START); _UnlockDocument(); m_AdviseSink.pTextStoreACPSink->OnLayoutChange(TS_LC_CHANGE, EDIT_VIEW_COOKIE); return hr;}
开发者ID:yohei-yoshihara,项目名称:TouchMind,代码行数:11,
注:本文中的GetTextLength函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetTextPeer函数代码示例 C++ GetTextColor函数代码示例 |