本文整理汇总了C++中CCEditBox::setInputFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCEditBox::setInputFlag方法的具体用法?C++ CCEditBox::setInputFlag怎么用?C++ CCEditBox::setInputFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCEditBox
的用法示例。
在下文中一共展示了CCEditBox::setInputFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogInTableDraw
void LogInScene::LogInTableDraw(int _index){
CCMenu* popUpMenu = (CCMenu*)popUpMenuLayer->getChildByTag(998);
CCMenu* beginMenu = (CCMenu*)this->getChildByTag(997);
popUpMenu->setTouchEnabled(false);
if (beginMenu!=NULL)
beginMenu->setTouchEnabled(false);
//1.基本层
AccountLayer = CCLayer::create();
AccountLayer->setPosition(CCPointZero);
addChild(AccountLayer,10);
//2.黑色遮罩:不在该移动层上
CCLayerColor* black = CCLayerColor::create(ccc4(0, 0, 0, 155));
black->setPosition(CCPointZero);
AccountLayer->addChild(black,0);
//3.木板
CCSprite* LogInTable = CCSprite::createWithSpriteFrameName("LogInTable.png");
LogInTable->setPosition(ccp(size.width/2, size.height/2+winDif*2));
AccountLayer->addChild(LogInTable,1);
//3.edit box - user name
CCScale9Sprite *UserNameTexture = CCScale9Sprite::createWithSpriteFrameName("textTable.png");
CCEditBox *UserNameBox=CCEditBox::create(CCSizeMake(195, 44), UserNameTexture);
UserNameBox->setPosition(ccp(size.width*8/15, size.height*0.561+winDif*2));
UserNameBox->setFontName("Arial Rounded MT bold");
UserNameBox->setMaxLength(20);
UserNameBox->setInputMode(kEditBoxInputModeAny);
UserNameBox->setInputFlag(kEditBoxInputFlagSensitive);
UserNameBox->setReturnType(kKeyboardReturnTypeDone);
UserNameBox->setDelegate(this);
AccountLayer->addChild(UserNameBox,2,10);
//4.edit box - password
CCScale9Sprite *PasswordTexture = CCScale9Sprite::createWithSpriteFrameName("textTable.png");
CCEditBox *PasswordBox = CCEditBox::create(CCSizeMake(195, 44), PasswordTexture);
PasswordBox->setPosition(ccp(size.width*8/15, size.height*0.486+winDif*2));
PasswordBox->setFontName("Arial Rounded MT bold");
PasswordBox->setMaxLength(50);
PasswordBox->setInputMode(kEditBoxInputModeAny);
PasswordBox->setInputFlag(kEditBoxInputFlagPassword);
PasswordBox->setReturnType(kKeyboardReturnTypeDone);
PasswordBox->setDelegate(this);
AccountLayer->addChild(PasswordBox,2,11);
//5.登录注册按钮
CCMenuItemSprite* Item1;
if (_index == 0){
CCSprite* item1Sprite = CCSprite::createWithSpriteFrameName("signUpButtonGreen.png");
CCSprite* item1Sprite_s = CCSprite::createWithSpriteFrameName("signUpButtonGreen-s.png");
Item1 = CCMenuItemSprite::create(item1Sprite,item1Sprite_s,this,menu_selector(LogInScene::SignUpHTTP));
}
else if (_index == 1){
CCSprite* item1Sprite = CCSprite::createWithSpriteFrameName("binding.png");
CCSprite* item1Sprite_s = CCSprite::createWithSpriteFrameName("binding-s.png");
Item1 = CCMenuItemSprite::create(item1Sprite,item1Sprite_s,this,menu_selector(LogInScene::bindUserAccountHTTP));
}
else if (_index == 2){
CCSprite* item1Sprite = CCSprite::createWithSpriteFrameName("LogInButton.png");
CCSprite* item1Sprite_s = CCSprite::createWithSpriteFrameName("LogInButton-s.png");
Item1 = CCMenuItemSprite::create(item1Sprite,item1Sprite_s,this,menu_selector(LogInScene::LogInHTTP));
}
CCSprite* item2Sprite = CCSprite::createWithSpriteFrameName("cancelButton.png");
CCSprite* item2Sprite_s = CCSprite::createWithSpriteFrameName("cancelButton-s.png");
CCMenuItemSprite* Item2 = CCMenuItemSprite::create(item2Sprite,item2Sprite_s,this,menu_selector(LogInScene::closeThisLayer));
Item1->setPosition(ccp(winSize.width*11.5/30,size.height*0.42+winDif*2));
Item2->setPosition(ccp(winSize.width*18.5/30,size.height*0.42+winDif*2));
CCMenu* LogInMenu = CCMenu::create(Item1,Item2,NULL);
LogInMenu->setPosition(CCPointZero);
AccountLayer->addChild(LogInMenu,3);
}
示例2: init
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCScale9Sprite* sacel9SprY = CCScale9Sprite::create("[email protected]");
CCEditBox* box = CCEditBox::create(CCSizeMake(200, 80), sacel9SprY);
//设置编辑框内的文字
// box->setText("xcc");
//设置位置
box->setPosition(ccp(200, 200));
//获取编辑框内的文字
CCLOG("Text:%s",box->getText());
box->setDelegate(this);
//设置文本的颜色
box->setFontColor(ccc3(255, 0, 0));
//当编辑框中没有任何字符的提示
box->setPlaceHolder("请输入账号:");
//最大输入文本长度
box->setMaxLength(3);
box->setInputMode(kEditBoxInputModeAny);
// kEditBoxInputModeAny: 开启任何文本的输入键盘,包括换行
// kEditBoxInputModeEmailAddr: 开启 邮件地址 输入类型键盘
// kEditBoxInputModeNumeric: 开启 数字符号 输入类型键盘
// kEditBoxInputModePhoneNumber: 开启 电话号码 输入类型键盘
// kEditBoxInputModeUrl: 开启 URL 输入类型键盘
// kEditBoxInputModeDecimal: 开启 数字 输入类型键盘,允许小数点
// kEditBoxInputModeSingleLine: 开启任何文本的输入键盘,不包括换行
box->setReturnType(kKeyboardReturnTypeSearch);
// kKeyboardReturnTypeDefault: 默认使用键盘return 类型
// kKeyboardReturnTypeDone: 默认使用键盘return类型为“Done”字样
// kKeyboardReturnTypeSend: 默认使用键盘return类型为“Send”字样
// kKeyboardReturnTypeSearch: 默认使用键盘return类型为“Search”字样
// kKeyboardReturnTypeGo: 默认使用键盘return类型为“Go”字样
//设置该属性输入密码时为替代符
box->setInputFlag(kEditBoxInputFlagPassword);
this->addChild(box);
return true;
}