本文整理汇总了C++中cegui::Editbox::eraseSelectedText方法的典型用法代码示例。如果您正苦于以下问题:C++ Editbox::eraseSelectedText方法的具体用法?C++ Editbox::eraseSelectedText怎么用?C++ Editbox::eraseSelectedText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Editbox
的用法示例。
在下文中一共展示了Editbox::eraseSelectedText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyToClipboard
void ControllerUI::CopyToClipboard(::CEGUI::Window* EditBox, bool Cut)
{
if (!EditBox)
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)
{
// get text from cegui textbox
::CEGUI::String boxStr = box->getText();
size_t start = box->getSelectionStartIndex();
size_t len = box->getSelectionLength();
// get substring which is selected
boxStr = boxStr.substr(start, len);
// copy to clipboard
if (boxStr.length() > 0)
{
::System::Windows::Forms::Clipboard::SetText(StringConvert::CEGUIToCLR(boxStr));
if (Cut)
box->eraseSelectedText();
}
}
// type of MultiLineEditbox
else if (mlbox)
{
// get text from cegui textbox
::CEGUI::String boxStr = mlbox->getText();
size_t start = mlbox->getSelectionStartIndex();
size_t len = mlbox->getSelectionLength();
// get substring which is selected
boxStr = boxStr.substr(start, len);
// copy to clipboard
if (boxStr.length() > 0)
{
::System::Windows::Forms::Clipboard::SetText(StringConvert::CEGUIToCLR(boxStr));
if (Cut)
mlbox->eraseSelectedText();
}
}
};