本文整理汇总了C++中cegui::Editbox::getText方法的典型用法代码示例。如果您正苦于以下问题:C++ Editbox::getText方法的具体用法?C++ Editbox::getText怎么用?C++ Editbox::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Editbox
的用法示例。
在下文中一共展示了Editbox::getText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAgentSaleUIDate
//更新寄售UI提示
bool UpdateAgentSaleUIDate(const CEGUI::EventArgs& e)
{
CEGUI::WindowManager& mgr = GetWndMgr();
CEGUI::Window* wnd = NULL;
CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditNum"));//寄售数量
uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText());
edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditPrice"));//寄售单价
uint price = CEGUI::PropertyHelper::stringToInt(edb->getText());
if(cnt == 0 || price == 0)//任意一个为0,则直接返回,不更新UI
{
//设置支付手续费提示
wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold");
wnd->setText("");
return false;
}
//设置支付位面提示
wnd = mgr.getWindow("Auction/Tab/Agent/sale/subNum");
wnd->setText(CEGUI::PropertyHelper::intToString(cnt * ORDER_PER_NUM));
//设置支付手续费提示
wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold");
float extraCust = cnt * price * AGENT_EXTRACUST ;
wnd->setText(CEGUI::PropertyHelper::intToString((int)extraCust));
return true;
}
示例2: UpdateAgentBuyUIDate
//更新委托求购界面提示
bool UpdateAgentBuyUIDate(const CEGUI::EventArgs& e)
{
CEGUI::WindowManager& mgr = GetWndMgr();
CEGUI::Window* wnd = NULL;
//求购数量
CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/Buy/EditNum"));
uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText());
//求购单价
edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/Buy/EditPrice"));
uint price = CEGUI::PropertyHelper::stringToInt(edb->getText());
if(cnt == 0 || price == 0)//如何一个为0,直接返回
{
wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subGold");
wnd->setText("");//手续费
wnd = mgr.getWindow("Auction/Tab/Agent/Buy/Text");//总共支付
wnd->setText("");
return false;
}
//设置委托购买位面总价提示
wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subNum");
uint sumPrice = price * cnt;
wnd->setText(CEGUI::PropertyHelper::intToString(sumPrice));
float extreCust = price * cnt * AGENT_EXTRACUST;//手续费
wnd = mgr.getWindow("Auction/Tab/Agent/Buy/subGold");
wnd->setText(CEGUI::PropertyHelper::intToString((int)extreCust));
wnd = mgr.getWindow("Auction/Tab/Agent/Buy/Text");//总共支付
wnd->setText(CEGUI::PropertyHelper::intToString((sumPrice + (int)extreCust)));
return true;
}
示例3: UpdateSaleUIDate
bool UpdateSaleUIDate( const CEGUI::EventArgs& e )
{
CEGUI::WindowManager& mgr = GetWndMgr();
CEGUI::Window* weimian = mgr.getWindow("Auction/SaleWnd/Text61");
weimian->setText("");
CEGUI::Window* gold = mgr.getWindow("Auction/SaleWnd/Text6");
gold->setText("");
//获取输入的出售数目
CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/SaleWnd/saleNum"));
if(!edb)
return false;
uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText());
if(saleNum==0)
return false;
//设置支付位面数
weimian->setText(edb->getText());
AHdata& ah = GetInst(AHdata);
uint orderID = ah.GetCanSaleID();//获取要出售的订单ID
uint price = ah.GetPriceByCanSaleID(orderID);//单价
//计算价格
uint subCust = saleNum * price;
//设置需要支付金币
gold->setText(CEGUI::PropertyHelper::intToString(subCust));
return true;
}
示例4: OnCreateRoleBtn
bool CREvent::OnCreateRoleBtn(const CEGUI::EventArgs &e)
{
if (GetInst(SelectRolePage).GetPlayerCount() >= 1)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Base_34")); //目前不能创建更多的角色了!
return false;
}
CEGUI::Window *pPageWin = GetInst(CreateRolePage).GetPageWindow();
CEGUI::Editbox* pNameEdit = static_cast<CEGUI::Editbox*>(pPageWin->getChild("EditName"));
const char * strName = CEGUIStringToAnsiChar(pNameEdit->getText());
if (strcmp(strName,"") == 0)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_72")); //"名字不能为空"
return false;
}
if (!CheckName(strName))
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_73")); //"名字中不能有空格"
return false;
}
int iSex = random(2);
//RandomChoseDetails();
//RandomChoseCountry();
BYTE lConstellation = random(12) + 1;
//const char *strName,char nOccupation, char nSex, BYTE lHead, BYTE lFace, BYTE lCountry,BYTE lConstellation,BYTE bRandCountry
GetGame()->C2L_AddRole_Send(strName, 0, (char)GetSelectSex(), GetHair(), GetFace(), GetSelectCountry(), lConstellation, 0 );
return true;
}
示例5: OnAgentSaleSubmit
bool OnAgentSaleSubmit(const CEGUI::EventArgs& e)
{
//得到委托出售数目和单价
AH::OrderRaw or;
CEGUI::Editbox* edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/sale/EditNum"));
if(!edb)
return false;
or.id = -1;//-1标识 id不会用到
//单数
or.cnt = CEGUI::PropertyHelper::stringToInt(edb->getText());
if(or.cnt == 0)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_109"),NULL,NULL,true);
return false;
}
edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/sale/EditPrice"));
if(!edb)
return false;
//单价
or.price = CEGUI::PropertyHelper::stringToInt(edb->getText());
if(or.price == 0)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_110"),NULL,NULL,true);
return false;
}
//检查玩家身上位面是否满足数目
CPlayer* player = GetGame()->GetMainPlayer();
long cnt = player->GetGoodsAmount(CGlobeSetup::GetSetup()->strWeiMianName);
if(cnt < or.cnt * 100 ) //玩家身上数量小于出售数量
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_111"),NULL,NULL,true);
return false;
}
//检查玩家身上的金币是否满足委托收取的手续费
long money = player->GetMoney();
float custm = or.cnt * or.price * AGENT_EXTRACUST;//算上手续费
if ( custm > money )
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_112"),NULL,NULL,true);
return false;
}
//提交委托出售订单
AHdata& ah = GetInst(AHdata);
ah.Send_AH_ADD_AGENT(or,AH::OT_SELL);
return true;
}
示例6: 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();
}
}
};
示例7: OnAgentBuySubmit
bool OnAgentBuySubmit(const CEGUI::EventArgs& e)
{
//得到委托购买数目和单价
AH::OrderRaw or;
CEGUI::Editbox* edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/Buy/EditNum"));
if(!edb)
return false;
or.id = -1 ;// -1标识ID不会用到
//数目
or.cnt = CEGUI::PropertyHelper::stringToInt(edb->getText());//单位为:百个
if(or.cnt == 0)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_106"),NULL,NULL,true);
return false;
}
edb = WEditBox(GetWndMgr().getWindow("Auction/Tab/Agent/Buy/EditPrice"));
if(!edb)
return false;
//单价
or.price = CEGUI::PropertyHelper::stringToInt(edb->getText());// 金币/100位面
if(or.price == 0)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_107"),NULL,NULL,true);
}
//检查玩家身上金币是否满足购买条件
CPlayer* player = GetGame()->GetMainPlayer();
long money = player->GetMoney();
float custm = or.price * or.cnt * AGENT_EXTRACUST ;//算上手续费
if( custm > money)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_108"),NULL,NULL,true);
return false;
}
//提交委托购买订单
AHdata& ah = GetInst(AHdata);
ah.Send_AH_ADD_AGENT(or,AH::OT_BUY);
return true;
}
示例8: HandleConnect
/***********************************************************
handle connect button event
***********************************************************/
bool LoginGUI::HandleConnect(const CEGUI::EventArgs& e)
{
try
{
CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame")->hide();
CEGUI::Editbox * lt = static_cast<CEGUI::Editbox *> (
CEGUI::WindowManager::getSingleton().getWindow("LoginText"));
CEGUI::Editbox * pt = static_cast<CEGUI::Editbox *> (
CEGUI::WindowManager::getSingleton().getWindow("PasswordText"));
CEGUI::Checkbox * cbl = static_cast<CEGUI::Checkbox *> (
CEGUI::WindowManager::getSingleton().getWindow("LoginPlayLocalCb"));
if(lt && pt && cbl)
{
bool seleplaylo = cbl->isSelected();
std::string txtl = lt->getText().c_str();
std::string txtt = pt->getText().c_str();
if((txtl != "") && (txtl.size() <= 20) && (txtt.size() <= 20))
{
std::string samples = "Data/Samples/lba2launcherblob.wav";
MusicHandler::getInstance()->PlaySample(samples, 0);
ConfigurationManager::GetInstance()->SetString("Player.Name", txtl);
pt->setText("");
ThreadSafeWorkpile::getInstance()->AddEvent(new LoginEvent(txtl, txtt, seleplaylo));
}
}
}
catch(CEGUI::Exception &ex)
{
LogHandler::getInstance()->LogToFile(std::string("Exception trying to get connection info from the gui: ") + ex.getMessage().c_str());
return false;
}
return true;
}
示例9: OnSaleSubmit
//提交出售请求
bool OnSaleSubmit(const CEGUI::EventArgs& e)
{
CEGUI::WindowManager& wndmgr = GetWndMgr();
CEGUI::Editbox* edb = WEditBox(wndmgr.getWindow("Auction/SaleWnd/saleNum"));
AHdata& ah = GetInst(AHdata);
//获取出售数量
uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText());
uint cansaleNum = ah.GetCountByCanSaleID(ah.GetCanSaleID());
if(saleNum == 0 || saleNum > cansaleNum )
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_101"),NULL,NULL,true);
return false;
}
ah.Send_AH_SEL(cansaleNum);//发送出售请求前要设置出售的订单ID
return true;
}
示例10: OnBuySubmit
////提交购买请求
bool OnBuySubmit(const CEGUI::EventArgs& e)
{
CEGUI::WindowManager& wndmgr = GetWndMgr();
CEGUI::Editbox* edb = WEditBox(wndmgr.getWindow("Auction/Buy/buyNum"));
AHdata& ah = GetInst(AHdata);
//获取购买数量
uint buyNum = CEGUI::PropertyHelper::stringToInt(edb->getText());
uint canbuyNum = ah.GetCountByCanBuyID(ah.GetCanBuyID());
if(buyNum== 0 || buyNum > canbuyNum)
{
GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_103"),NULL,NULL,true);
return false;
}
ah.Send_AH_BUY(buyNum);//发送购买请求前要设置购买的订单ID
return true;
}
示例11: enterHighScore
bool GameState::enterHighScore(const CEGUI::EventArgs& /*e*/)
{
if(!_highScoreEntryDialog)
return false;
CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(winMgr.getWindow("Editbox"));
std::string name(editbox->getText().c_str());
if(name.length() == 0)
return false;
Lagom::getSingleton().addHighScore(name,Lagom::getSingleton().GetChallengeStage(),_playerScore);
CEGUI::System::getSingleton().setGUISheet( nullptr );
_highScoreEntryDialog->destroy();
m_bQuit = true;
return true;
}
示例12: handleLoginAcceptButtonClicked
bool GameMenuDemo::handleLoginAcceptButtonClicked(const CEGUI::EventArgs& args)
{
d_startButtonClickArea->setAlpha(0.0f);
d_startButtonBlendInAnimInst->start();
enableNavigationBarElements();
d_loginContainerMoveOutInst->start();
d_navigationTravelIcon->setEnabled(true);
CEGUI::Editbox* loginEditbox = static_cast<CEGUI::Editbox*>(d_root->getChild("LoginContainer/LoginEditbox"));
d_userName = loginEditbox->getText();
d_timeSinceLoginAccepted = 0.0f;
d_loginWasAccepted = true;
d_currentWriteFocus = WF_TopBar;
d_botNaviContainer->setEnabled(true);
return false;
}
示例13: ValidateNAMEIP
void MenuState::ValidateNAMEIP()
{
// This shouldn't be here!!!
// Socket needs to be closed/reset before IO_Service is reset.
if(LC::Client::getSingletonPtr()->socket_)
{
boost::shared_ptr<tcp::socket> sockets;
sockets = LC::Client::getSingletonPtr()->socket_;
boost::system::error_code error;
sockets->shutdown(boost::asio::socket_base::shutdown_both, error);
sockets->close(error);
}
LC::Client::getSingletonPtr()->socket_.reset();
// May be overly drastic.
TheApplication.ResetIOService();
if(m_IsHost)
{
// Create Server.
std::string userName = wmgr->getWindow("LIGHTCYCLEMENU/Name/EditBox")->getText().c_str();
Server::getSingletonPtr()->reset(TheApplication.getIOService(), userName);
// Create Client.
// Need better way of doing this.
tcp::resolver resolver(*TheApplication.getIOService());
std::ostringstream ss;
int portnumber = TheApplication.getPortNumber();
ss << portnumber;
tcp::resolver::query query("127.0.0.1", ss.str().c_str());
tcp::resolver::iterator iterator = resolver.resolve(query);
Client::getSingletonPtr()->reset(TheApplication.getIOService(), iterator, userName);
wmgr->getWindow("LIGHTCYCLEMENU/Lobby/ConnectedIP")->setText("IP: SERVER");
wmgr->getWindow("LIGHTCYCLEMENU/IP/EditBox")->setText("");
wmgr->getWindow("LIGHTCYCLEMENU/Name/EditBox")->setText("");
}
else
{
std::string text = wmgr->getWindow("LIGHTCYCLEMENU/IP/EditBox")->getText().c_str();
// Check for valid IP address.
boost::system::error_code ec;
boost::asio::ip::address address = boost::asio::ip::address::from_string(text, ec);
std::string userName = wmgr->getWindow("LIGHTCYCLEMENU/Name/EditBox")->getText().c_str();
if(!ec && userName.length()>=1)
{
CEGUI::String IPAddress = wmgr->getWindow("LIGHTCYCLEMENU/IP/EditBox")->getText();
// Need better way of doing this.
tcp::resolver resolver(*TheApplication.getIOService());
std::ostringstream ss;
int portnumber = TheApplication.getPortNumber();
ss << portnumber;
tcp::resolver::query query(IPAddress.c_str(), ss.str().c_str());
tcp::resolver::iterator iterator = resolver.resolve(query);
Client::getSingletonPtr()->reset(TheApplication.getIOService(), iterator, userName);
wmgr->getWindow("LIGHTCYCLEMENU/Lobby/ConnectedIP")->setText("IP: " + address.to_string());
}
else if(ec)
{
wmgr->getWindow("LIGHTCYCLEMENU/IP/EditBox")->setText("Invalid Address");
CEGUI::Editbox *editBox = static_cast<CEGUI::Editbox*>(wmgr->getWindow("LIGHTCYCLEMENU/IP/EditBox"));
editBox->setCaratIndex(editBox->getText().length());
}
}
}
示例14: GUI_Paste_From_Clipboard
bool GUI_Paste_From_Clipboard( void )
{
CEGUI::Window *sheet = CEGUI::System::getSingleton().getGUISheet();
// no sheet
if( !sheet )
{
return 0;
}
CEGUI::Window *window_active = sheet->getActiveChild();
// no active window
if( !window_active )
{
return 0;
}
const CEGUI::String &type = window_active->getType();
// MultiLineEditbox
if( type.find( "/MultiLineEditbox" ) != CEGUI::String::npos )
{
CEGUI::MultiLineEditbox *editbox = static_cast<CEGUI::MultiLineEditbox*>(window_active);
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
CEGUI::String new_text = editbox->getText();
// erase selected text
new_text.erase( beg, len );
// get clipboard text
CEGUI::String clipboard_text = reinterpret_cast<const CEGUI::utf8*>(Get_Clipboard_Content().c_str());
// set new text
editbox->setText( new_text.insert( beg, clipboard_text ) );
// set new carat index
editbox->setCaratIndex( editbox->getCaratIndex() + clipboard_text.length() );
}
// Editbox
else if( type.find( "/Editbox" ) != CEGUI::String::npos )
{
CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox*>(window_active);
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
CEGUI::String new_text = editbox->getText();
// erase selected text
new_text.erase( beg, len );
// get clipboard text
CEGUI::String clipboard_text = reinterpret_cast<const CEGUI::utf8*>(Get_Clipboard_Content().c_str());
// set new text
editbox->setText( new_text.insert( beg, clipboard_text ) );
// set new carat index
editbox->setCaratIndex( editbox->getCaratIndex() + clipboard_text.length() );
}
else
{
return 0;
}
return 1;
}
示例15: HandleEnterKey
//.........这里部分代码省略.........
if(we.scancode == CEGUI::Key::ArrowDown)
{
if(_itltext != _lasttexts.end())
{
if(_itltext != _lasttexts.begin())
--_itltext;
else
_itltext = _lasttexts.end();
}
if(_itltext != _lasttexts.end())
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText(
(const unsigned char *)_itltext->c_str());
}
else
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText("");
}
return true;
}
if(we.scancode == CEGUI::Key::ArrowUp || we.scancode == CEGUI::Key::ArrowDown)
return true;
// paste text
if(we.scancode == CEGUI::Key::V && _control_key_on)
{
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
(CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"));
if(bed->isActive())
{
if(_text_copyed != "")
{
size_t selB = bed->getSelectionStartIndex();
size_t selE = bed->getSelectionLength();
CEGUI::String str = bed->getText();
if(selE > 0)
{
str = str.erase(selB, selE);
}
if(str.size() + _text_copyed.size() < bed->getMaxTextLength())
{
size_t idx = bed->getCaratIndex();
str = str.insert(idx, (unsigned char *)_text_copyed.c_str());
bed->setText(str);
bed->setCaratIndex(idx + _text_copyed.size());
}
}
return true;
}
}
}
// copy text
if(we.scancode == CEGUI::Key::C && _control_key_on)
{
CEGUI::Window * actw = _myChat->getActiveChild();
if(actw != NULL)
{
if(actw->getName() == "Chat/edit")
{
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *> (actw);
size_t selB = bed->getSelectionStartIndex();
size_t selE = bed->getSelectionLength();
if(selE > 0)
{
CEGUI::String str = bed->getText().substr(selB, selE);
_text_copyed = str.c_str();
}
return true;
}
else
{
CEGUI::MultiLineEditbox* txt = static_cast<CEGUI::MultiLineEditbox *>(actw);
size_t selB = txt->getSelectionStartIndex();
size_t selE = txt->getSelectionLength();
if(selE > 0)
{
CEGUI::String str = txt->getText().substr(selB, selE);
_text_copyed = str.c_str();
}
return true;
}
}
}
return false;
}