本文整理汇总了C++中cegui::Editbox::setCaretIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Editbox::setCaretIndex方法的具体用法?C++ Editbox::setCaretIndex怎么用?C++ Editbox::setCaretIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Editbox
的用法示例。
在下文中一共展示了Editbox::setCaretIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: historiqueHaut
void GuiChat::historiqueHaut()
{
CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(chatWindow->getChild("Editbox"));
d_historyPos = ceguimax(d_historyPos - 1, -1);
if (d_historyPos >= 0)
{
editbox->setText(d_history[d_historyPos]);
editbox->setCaretIndex(static_cast<size_t>(-1));
}
else
{
editbox->setText("");
}
editbox->activate();
}
示例2: historiqueBas
void GuiChat::historiqueBas()
{
CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(chatWindow->getChild("Editbox"));
d_historyPos = ceguimin(d_historyPos + 1, static_cast<int>(d_history.size()));
if (d_historyPos < static_cast<int>(d_history.size()))
{
editbox->setText(d_history[d_historyPos]);
editbox->setCaretIndex(static_cast<size_t>(-1));
}
else
{
editbox->setText("");
}
editbox->activate();
}
示例3: PasteFromClipboard
void ControllerUI::PasteFromClipboard(::CEGUI::Window* EditBox)
{
if (!EditBox || !::System::Windows::Forms::Clipboard::ContainsText())
return;
// get text from clipboard
::System::String^ clipText = ::System::Windows::Forms::Clipboard::GetText(
::System::Windows::Forms::TextDataFormat::Text);
// no text
if (!clipText || clipText->Length == 0)
return;
// get possibly typed instances we process
CEGUI::Editbox* box = dynamic_cast<CEGUI::Editbox*>(EditBox);
CEGUI::MultiLineEditbox* mlbox = dynamic_cast<CEGUI::MultiLineEditbox*>(EditBox);
// type of Editbox
if (box && !box->isReadOnly())
{
// replace newline characters
clipText = clipText->Replace(
::System::Environment::NewLine, ::System::String::Empty);
// get caretindex
size_t caretindex = box->getCaretIndex();
// insert new text
box->insertText(StringConvert::CLRToCEGUI(clipText), caretindex);
// set caret at the end of inserted text
box->setCaretIndex(caretindex + clipText->Length);
}
// type of MultiLineEditbox
else if (mlbox && !mlbox->isReadOnly())
{
// get caretindex
size_t caretindex = mlbox->getCaretIndex();
// insert new text
mlbox->insertText(StringConvert::CLRToCEGUI(clipText), caretindex);
// set caret at the end of inserted text
mlbox->setCaretIndex(caretindex + clipText->Length);
}
};