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

C++ setCursorPos函数代码示例

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

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



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

示例1: removeCharacter

bool UILineEdit::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifiers)
{
    if(keyCode == Fw::KeyDelete) // erase right character
        removeCharacter(true);
    else if(keyCode == Fw::KeyBackspace) // erase left character {
        removeCharacter(false);
    else if(keyCode == Fw::KeyRight) // move cursor right
        moveCursor(true);
    else if(keyCode == Fw::KeyLeft) // move cursor left
        moveCursor(false);
    else if(keyCode == Fw::KeyHome) // move cursor to first character
        setCursorPos(0);
    else if(keyCode == Fw::KeyEnd) // move cursor to last character
        setCursorPos(m_text.length());
    else if(keyCode == Fw::KeyV && keyboardModifiers == Fw::KeyboardCtrlModifier)
        appendText(g_window.getClipboardText());
    else if(keyCode == Fw::KeyTab) {
        if(!m_alwaysActive) {
            if(UIWidgetPtr parent = getParent())
                parent->focusNextChild(Fw::TabFocusReason);
        }
    } else if(!keyText.empty() && (keyboardModifiers == Fw::KeyboardNoModifier || keyboardModifiers == Fw::KeyboardShiftModifier))
        appendText(keyText);
    else
        return false;

    return true;
}
开发者ID:brun123,项目名称:otclient,代码行数:28,代码来源:uilineedit.cpp


示例2: handle

// Pressed left button
long TextLabel::onLeftBtnPress(FXObject*,FXSelector,void* ptr)
{
    FXEvent* ev=(FXEvent*)ptr;
    handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
    if (isEnabled())
    {
        grab();
        if (target && target->tryHandle(this,FXSEL(SEL_LEFTBUTTONPRESS,message),ptr))
        	return 1;
        flags&=~FLAG_UPDATE;
        if (ev->click_count==1)
        {
            setCursorPos(index(ev->win_x));
            if (ev->state&SHIFTMASK)
                extendSelection(cursor);
            else
            {
                killSelection();
                setAnchorPos(cursor);
            }
            makePositionVisible(cursor);
            flags|=FLAG_PRESSED;
        }
        else
        {
            setAnchorPos(0);
            setCursorPos(contents.length());
            extendSelection(contents.length());
            makePositionVisible(cursor);
        }
        return 1;
    }
    return 0;
}
开发者ID:tindzk,项目名称:Xfe,代码行数:35,代码来源:TextLabel.cpp


示例3: consoleEnd

void consoleEnd() {
	setCursorPos(0);
	if (completionEnd>cmdEnd)
		setCursorPos(completionEnd);
	else
		setCursorPos(cmdEnd);
	drawerInvokeRedisplay();
}
开发者ID:Zereges,项目名称:geometric-figures,代码行数:8,代码来源:console.c


示例4: handled

bool TextInputWidget::handleKey(int key) {
	bool handled(true);
	
	if (!_hasFocus) return false;
	std::wstring old_input(_input);
	
	int size = static_cast<int>(_input.size());
	
	switch (key) {
	
		case osgGA::GUIEventAdapter::KEY_Left: 
			setCursorPos(_cursorPos - 1);
			break;
		case osgGA::GUIEventAdapter::KEY_Right:
			setCursorPos(_cursorPos + 1);
			break;
		
		case osgGA::GUIEventAdapter::KEY_BackSpace:
			if ((_cursorPos >= size) && (size >=1)) 
			{
				// letztes Zeichen löschen
				_input = _input.substr(0, size - 2);
				setCursorPos(getCursorPosition()-1);
			}
			else if ((_cursorPos >= 0) &&  (_cursorPos < size)) 
			{
				//Zeichen links vom Cursor löschen
				_input = _input.substr(0,_cursorPos)+_input.substr(_cursorPos+1, size);
				setCursorPos(getCursorPosition()-1);
			}
			break;
		case osgGA::GUIEventAdapter::KEY_Delete:
		case osgGA::GUIEventAdapter::KEY_KP_Delete:
			if ((_cursorPos > 0) &&  (_cursorPos < size-1))
				_input = _input.substr(0,_cursorPos+1)+_input.substr(_cursorPos+2, size);
			break;
			
		default:
			if (key >= 0xff00) {
				handled = false;
			} else {
				// std::cout <<"key " << key << std::endl;
				// TODO hande utf?
				if (_cursorPos < size)
					_input.insert(_cursorPos+1, 1, static_cast<char>(key)); 
				else 
					_input += static_cast<char>(key);
				
				_cursorPos++;
			}
	}
	
	if (_input != old_input)
		informAttachedResponder(Actions::valueChanged());
	if (handled)
		update();
	return handled;
}
开发者ID:cefix,项目名称:cefix,代码行数:58,代码来源:TextInputWidget.cpp


示例5: consoleRight

void consoleRight() {
	if ((cursorPos+cursorLen<cmdEnd) || (cursorPos+cursorLen<completionEnd)) {
		if (cursorPos+cursorLen==cmdEnd)
			setCursorPos(cursorPos+2);
		else
			setCursorPos(cursorPos+1);
	}
	drawerInvokeRedisplay();
}
开发者ID:Zereges,项目名称:geometric-figures,代码行数:9,代码来源:console.c


示例6: consoleLeft

void consoleLeft() {
	if (cursorPos>cmdBegin) {
		if (cursorPos==cmdEnd+1)
			setCursorPos(cursorPos-2);
		else
			setCursorPos(cursorPos-1);
	}
	drawerInvokeRedisplay();
}
开发者ID:Zereges,项目名称:geometric-figures,代码行数:9,代码来源:console.c


示例7: removeCharacter

bool UITextEdit::onKeyPress(uchar keyCode, int keyboardModifiers, int autoRepeatTicks)
{
    if(UIWidget::onKeyPress(keyCode, keyboardModifiers, autoRepeatTicks))
        return true;

    if(keyboardModifiers == Fw::KeyboardNoModifier) {
        if(keyCode == Fw::KeyDelete) { // erase right character
            removeCharacter(true);
            return true;
        } else if(keyCode == Fw::KeyBackspace) { // erase left character {
            removeCharacter(false);
            return true;
        } else if(keyCode == Fw::KeyRight && !m_shiftNavigation) { // move cursor right
            moveCursor(true);
            return true;
        } else if(keyCode == Fw::KeyLeft && !m_shiftNavigation) { // move cursor left
            moveCursor(false);
            return true;
        } else if(keyCode == Fw::KeyHome) { // move cursor to first character
            setCursorPos(0);
            return true;
        } else if(keyCode == Fw::KeyEnd) { // move cursor to last character
            setCursorPos(m_text.length());
            return true;
        } else if(keyCode == Fw::KeyTab && !m_shiftNavigation) {
            if(UIWidgetPtr parent = getParent())
                parent->focusNextChild(Fw::KeyboardFocusReason);
            return true;
        } else if(keyCode == Fw::KeyEnter && m_multiline) {
            appendCharacter('\n');
            return true;
        } else if(keyCode == Fw::KeyUp && !m_shiftNavigation && m_multiline) {
            
        } else if(keyCode == Fw::KeyDown && !m_shiftNavigation && m_multiline) {

        }
    } else if(keyboardModifiers == Fw::KeyboardCtrlModifier) {
        if(keyCode == Fw::KeyV) {
            appendText(g_window.getClipboardText());
            return true;
        }
    } else if(keyboardModifiers == Fw::KeyboardShiftModifier) {
        if(keyCode == Fw::KeyRight && m_shiftNavigation) { // move cursor right
            moveCursor(true);
            return true;
        } else if(keyCode == Fw::KeyLeft && m_shiftNavigation) { // move cursor left
            moveCursor(false);
            return true;
        }
    }

    return false;
}
开发者ID:LeandroPerrotta,项目名称:otclient,代码行数:53,代码来源:uitextedit.cpp


示例8: applyCompletion

void applyCompletion() {
	if (cursorPos>cmdEnd) {
		int pos=cursorPos;
		setCursorPos(0);
		consoleLines->str[pos]='\0';
		utilStrRmChars(consoleLines->str+cmdEnd, 1);
		cmdEnd=pos-1;
		setCursorPos(cmdEnd);
	} else {
		consoleLines->str[cmdEnd]='\0';
	}
	completionEnd=0;
}
开发者ID:Zereges,项目名称:geometric-figures,代码行数:13,代码来源:console.c


示例9: setCursorPos

// Clears the entire screen
bool Console::clearScreen(void)
{
	cout.flush();
	setCursorPos(0, 0);
	DWORD numCharactersWritten;
	COORD consoleCoords = {0, 0};
    GetConsoleScreenBufferInfo(consoleHandle, &consoleInfo);
    FillConsoleOutputCharacter(consoleHandle, ' ', consoleInfo.dwSize.X * consoleInfo.dwSize.Y, consoleCoords, &numCharactersWritten);
	FillConsoleOutputAttribute(consoleHandle, consoleInfo.wAttributes, consoleInfo.dwSize.X * consoleInfo.dwSize.Y, consoleCoords, &numCharactersWritten);
	setCursorPos(0, 0);
	cout.flush();

	return true;
}
开发者ID:watertoeast,项目名称:telnet,代码行数:15,代码来源:Console.cpp


示例10: setCursorPos

void TextEdit::onMouseDragged(const SimGui::Event &event)
{
    int pos = setCursorPos(event.ptMouse);
    
    //if the position is to the left
    if (pos == -1)
    {
       scrollDir = -1;
    }
    //else if the position is to the right
    else if (pos == -2)
    {
      scrollDir = 1;
    }
    //else set the new cursor position
    else
    {
        scrollDir = 0;
        cursorPos = pos;
    }
    
    //update the block
    blockStart = min(cursorPos, mouseDragStart);
    blockEnd = max(cursorPos, mouseDragStart);
    if (blockStart < 0) blockStart = 0;
    
    if (blockStart == blockEnd)
    {
        blockStart = blockEnd = 0;
    }
    
   //let the parent get the event
   Parent::onMouseDragged(event);
}
开发者ID:AltimorTASDK,项目名称:TribesRebirth,代码行数:34,代码来源:simGuiTextEdit.cpp


示例11: QWidget

QHexEditPrivate::QHexEditPrivate(QScrollArea *parent) : QWidget(parent)
{
    _undoStack = new QUndoStack(this);

    _scrollArea = parent;
    _asciiArea = true;

    setOverwriteMode(true);
    setCursorPos(0);
    setAddressArea(true);

    setAddressWidth(4);
    setAddressOffset(0);
    setAsciiArea(true);
    setHighlighting(true);
    setReadOnly(false);
    setAddressAreaColor(QColor(0xd4, 0xd4, 0xd4, 0xff));
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(QColor(0x6d, 0x9e, 0xff, 0xff));
    setFont(QFont("Courier", 10));

    _size = 0;
    resetSelection(0);

    setFocusPolicy(Qt::StrongFocus);

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    _cursorTimer.setInterval(500);
    _cursorTimer.start();
}
开发者ID:4sp1r3,项目名称:sqlitebrowser,代码行数:30,代码来源:qhexedit_p.cpp


示例12: consoleKeyPress

void consoleKeyPress(char c) {
	if (!cursorPos)
		openConsole("");
	applyCompletion();

	int pos=cursorPos;
	setCursorPos(0);
	cmdLineRealloc(1);
	utilStrInsertChar(consoleLines->str+pos, c);
	cmdEnd++;

	updateCompletions();

	setCursorPos(pos+1);
	drawerInvokeRedisplay();
}
开发者ID:Zereges,项目名称:geometric-figures,代码行数:16,代码来源:console.c


示例13: drawReminder

void drawReminder()
{	
	fb_setClipping(3,41,252, 150);
	
	fb_drawRect(0,37,255,148,textAreaFillColor);
	setFont(font_arial_9);
	setColor(textAreaTextColor);	
	setWrapToBorder();
	
	if(blinkOn())
	{
		if(isInsert())
			setCursorProperties(cursorNormalColor, 1, -1, 0);
		else
			setCursorProperties(cursorOverwriteColor, 1, -1, 0);
			
		showCursor();
		setCursorPos(getKBCursor());		
	}
	
	setFakeHighlight();
	
	fb_dispString(0,-3,reminder);
	
	setWrapNormal();
	hideCursor();
	clearHighlight();
	drawCurDay();
}
开发者ID:Flare183,项目名称:dsorganize,代码行数:29,代码来源:calendar.cpp


示例14: line1

void SciDoc::removeLine() {
//	LOGGER;

	JuffScintilla* edit = int_->curEdit_;
	if ( edit == NULL ) return;

	int line1(-1), line2(-1), col1(-1), col2(-1);
	if ( edit->hasSelectedText() ) {
		edit->getSelection(&line1, &col1, &line2, &col2);
		if ( col2 == 0 )
			--line2;

		if (line1 <= line2 && line1 >= 0) {
			setCursorPos(line1, 0);
			edit->beginUndoAction();
			for (int l = line1; l <= line2; ++l) {
				edit->SendScintilla(QsciScintilla::SCI_LINEDELETE);
			}
			edit->endUndoAction();
		}
	}
	else {
		edit->getCursorPosition(&line1, &col1);
		if ( line1 >= 0 ) {
			edit->SendScintilla(QsciScintilla::SCI_LINEDELETE);
		}
	}
}
开发者ID:MikeTekOn,项目名称:juffed,代码行数:28,代码来源:SciDoc.cpp


示例15: defined

bool BaseApp::onMouseMove(const int x, const int y, const int deltaX, const int deltaY){
	if (mouseCaptured){
#if defined(__APPLE__)
		wx -= (invertMouse? 1 : -1) * mouseSensibility * deltaY;
		wy -= mouseSensibility * deltaX;
#else
		static bool changed = false;
		if (changed = !changed){
			wx += (invertMouse? 1 : -1) * mouseSensibility * (height / 2 - y);
			wy += mouseSensibility * (width / 2 - x);
			setCursorPos(width / 2, height / 2);
		}
#endif

		return true;
	} else {

		if (widgets.goToFirst()){
			do {
				Widget *widget = widgets.getCurrent();
				if (widget->isEnabled() && widget->isVisible() && (widget->isInWidget(x, y) || widget->isCapturing())){
					//widgets.moveCurrentToTop();
					return widget->onMouseMove(x, y);
				}
			} while (widgets.goToNext());
		}
	}
	return false;
}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:29,代码来源:BaseApp.cpp


示例16: findCursorPos

// Erases the entire line that the cursor is on
bool Console::eraseEntireLine(void)
{
	cout.flush();
	findCursorPos();
	unsigned char tempX = xPos;
	
	setCursorPos(0, yPos);

	for(int i = 0; i < 80; i++)
		cout << " ";

	cout.flush();
	setCursorPos(tempX, yPos);
	
	return true;
}
开发者ID:watertoeast,项目名称:telnet,代码行数:17,代码来源:Console.cpp


示例17: setCursorPos

void QHexEditPrivate::scrollToEnd()
{
    setCursorPos(_xData.size() * 2);
    resetSelection(_cursorPosition);
    _scrollArea->ensureVisible(_cursorX, _cursorY + _charHeight/2, 3, _charHeight/2 + 2);
    update();
}
开发者ID:Jacob1988,项目名称:lxyppc-serial,代码行数:7,代码来源:qhexedit_p.cpp


示例18: getText

long fx_numeric_field::change_on_digit(int sign)
{
    FXString txt = getText();
    int pos = getCursorPos();

    int pow_exp, dot_pos;
    int norm = get_normalized_int (txt.text(), pow_exp, dot_pos);

    if (dot_pos < 0) return 0;

    int pos_exp = dot_pos - pos;
    if (pos_exp < 0)
        pos_exp ++;
    int inc_abs = ipow10 (pos_exp + pow_exp);

    norm += sign * inc_abs;

    FXString new_txt = denormalize (norm, pow_exp, dot_pos);
    int new_pos = dot_pos - pos_exp;
    if (pos_exp < 0)
        new_pos ++;

    setText(new_txt);
    setCursorPos(new_pos);

    if (target)
        target->tryHandle(this, FXSEL(SEL_CHANGED,message), (void*)new_txt.text());

    return 1;
}
开发者ID:lulzzz,项目名称:regress-pro,代码行数:30,代码来源:fx_numeric_field.cpp


示例19: dataChanged

void QHexEditPrivate::undo()
{
    _undoStack->undo();
    emit dataChanged();
    setCursorPos(_cursorPosition);
    update();
}
开发者ID:DDuarte,项目名称:IntWars2,代码行数:7,代码来源:qhexedit_p.cpp


示例20: adjust

void QHexEditPrivate::setData(const QByteArray &data)
{
    _xData.setData(data);
    _undoStack->clear();
    adjust();
    setCursorPos(0);
}
开发者ID:DDuarte,项目名称:IntWars2,代码行数:7,代码来源:qhexedit_p.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setCursorPosition函数代码示例发布时间:2022-05-30
下一篇:
C++ setCursor函数代码示例发布时间: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