本文整理汇总了C++中TextField类的典型用法代码示例。如果您正苦于以下问题:C++ TextField类的具体用法?C++ TextField怎么用?C++ TextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Track
Track(TrackInfo *trackInfo) : BaseTrack((BaseTrackInfo *) trackInfo) {
_trackInfo = trackInfo;
_exHandleL = new Sprite;
_exHandleR = new Sprite;
_exHandleL->setSize(35, 50);
_exHandleR->setSize(35, 50);
_exHandleL->isInteractive = true;
_exHandleR->isInteractive = true;
addChild(_exHandleL);
addChild(_exHandleR);
add_event(MouseEvent::UP, onUp);
add_event_on_context(MouseEvent::UP, onUp)
setColor(52, 52, 52);
TextField *input = new TextField;
input->setText("lllll");
input->move(5, 28);
addChild(input);
TextField *input2 = new TextField;
input2->setText("wwwww");
input2->move(5, 40);
addChild(input2);
}
开发者ID:solpie,项目名称:linAnil,代码行数:25,代码来源:Track.hpp
示例2: Length
fresult YNDialogForm::ShowYNDialog(char* dialogName, char* formTitle, char* formSubtitle, char* msgTitle, char* msgContent, char* yesText)
{
fresult fres;
_TitleText = formTitle;
_SubtitleText = formSubtitle;
_dialogName = dialogName;
uword_t headerLen = Length(msgTitle);
fres = _txtHeader->SetText(msgTitle);
ENSURESUCCESS(fres);
Size sz = _App->GetClientAreaSize();
fres = HCenterTextField(_txtHeader, CenterHorizontaly, headerLen, sz.Width, 0);
ENSURESUCCESS(fres);
fres = _txtContent->SetText(msgContent);
ENSURESUCCESS(fres);
TextField* tf = _miYes->GetTextField();
if (tf!=NULL)
{
fres = tf->SetText(yesText);
ENSURESUCCESS(fres);
uword_t yesTextLen = Length(yesText);
HCenterTextField(tf, ToRight, yesTextLen, sz.Width, 8);
}
fres = _FormManager->ShowForm(GetName());
ENSURESUCCESS(fres);
return SUCCESS;
}
开发者ID:Kreyl,项目名称:nute,代码行数:33,代码来源:YNDialogForm.cpp
示例3: init
bool UITextFieldTest_TrueTypeFont::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();
// Add a label in which the textfield events will be displayed
_displayValueLabel = Text::create("True Type Font Test - No Event","fonts/Marker Felt.ttf",32);
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
_uiLayer->addChild(_displayValueLabel);
// Add the alert
Text* alert = Text::create("TextField","fonts/Marker Felt.ttf",30);
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
_uiLayer->addChild(alert);
// Create the textfield
TextField* textField = TextField::create("input words here","fonts/A Damn Mess.ttf",30);
textField->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
textField->addEventListener(CC_CALLBACK_2(UITextFieldTest_TrueTypeFont::textFieldEvent, this));
_uiLayer->addChild(textField);
return true;
}
return false;
}
开发者ID:SPUDevelopers,项目名称:Naturalize,代码行数:29,代码来源:UITextFieldTest.cpp
示例4:
TextField *SimpleGui::addTextField(string name, string &value) {
TextField *field = (TextField*)INSTANTIATE_WITH_ID("textfield", name);
field->pointToValue(&value);
field->width = SIMPLE_GUI_WIDTH;
gui->addChild(field);
return field;
}
开发者ID:pettert,项目名称:ofxXmlGui,代码行数:7,代码来源:SimpleGui.cpp
示例5: utcDaliTextFieldTextChangedP
// Positive test for the text-changed signal.
int utcDaliTextFieldTextChangedP(void)
{
ToolkitTestApplication application;
tet_infoline(" utcDaliTextFieldTextChangedP");
TextField field = TextField::New();
DALI_TEST_CHECK( field );
Stage::GetCurrent().Add( field );
field.TextChangedSignal().Connect(&TestTextChangedCallback);
gTextChangedCallBackCalled = false;
field.SetProperty( TextField::Property::TEXT, "ABC" );
DALI_TEST_CHECK( gTextChangedCallBackCalled );
application.SendNotification();
field.SetKeyInputFocus();
gTextChangedCallBackCalled = false;
application.ProcessEvent( GenerateKey( "D", "D", 0, 0, 0, Integration::KeyEvent::Down ) );
DALI_TEST_CHECK( gTextChangedCallBackCalled );
END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:26,代码来源:utc-Dali-TextField.cpp
示例6: switch
void UITextFieldTest::textFieldEvent(Ref *pSender, TextField::EventType type)
{
switch (type)
{
case TextField::EventType::ATTACH_WITH_IME:
{
TextField* textField = dynamic_cast<TextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.225f,
Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2.0f)));
_displayValueLabel->setString(String::createWithFormat("attach with IME")->getCString());
}
break;
case TextField::EventType::DETACH_WITH_IME:
{
TextField* textField = dynamic_cast<TextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.175f, Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f)));
_displayValueLabel->setString(String::createWithFormat("detach with IME")->getCString());
}
break;
case TextField::EventType::INSERT_TEXT:
_displayValueLabel->setString(String::createWithFormat("insert words")->getCString());
break;
case TextField::EventType::DELETE_BACKWARD:
_displayValueLabel->setString(String::createWithFormat("delete word")->getCString());
break;
default:
break;
}
}
开发者ID:SPUDevelopers,项目名称:Naturalize,代码行数:35,代码来源:UITextFieldTest.cpp
示例7: utcDaliTextFieldAtlasRenderP
// Positive Atlas Text Renderer test
int utcDaliTextFieldAtlasRenderP(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextFieldAtlasRenderP");
StyleManager styleManager = StyleManager::Get();
styleManager.RequestDefaultTheme();
TextField field = TextField::New();
DALI_TEST_CHECK( field );
field.SetProperty( TextField::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
Stage::GetCurrent().Add( field );
try
{
// Render some text with the shared atlas backend
field.SetProperty( TextField::Property::RENDERING_BACKEND, Text::RENDERING_SHARED_ATLAS );
application.SendNotification();
application.Render();
}
catch( ... )
{
tet_result(TET_FAIL);
}
END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:29,代码来源:utc-Dali-TextField.cpp
示例8: lua_cocos2dx_TextField_addEventListenerTextField
static int lua_cocos2dx_TextField_addEventListenerTextField(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
TextField* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.TextField",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<TextField*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TextField_addEventListenerTextField'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerTextField(listener, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerTextField' function of TextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerTextField'.",&tolua_err);
return 0;
#endif
}
开发者ID:CocosRobot,项目名称:cocos2d-lua,代码行数:57,代码来源:lua_cocos2dx_gui_manual.cpp
示例9: TextField
TextField* TextField::create()
{
TextField* widget = new TextField();
if (widget && widget->init())
{
CC_SAFE_AUTORELEASE(widget);
return widget;
}
CC_SAFE_DELETE(widget);
return NULL;
}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:11,代码来源:TextField.cpp
示例10: TextField
TextField* TextField::create()
{
TextField* widget = new TextField();
if (widget && widget->init())
{
widget->autorelease();
return widget;
}
CC_SAFE_DELETE(widget);
return NULL;
}
开发者ID:237676098,项目名称:quick-cocos2d-x,代码行数:11,代码来源:UITextField.cpp
示例11: new
TextField* TextField::create()
{
TextField* widget = new (std::nothrow) TextField();
if (widget && widget->init())
{
widget->autorelease();
return widget;
}
CC_SAFE_DELETE(widget);
return nullptr;
}
开发者ID:superman-t,项目名称:PlaneGame,代码行数:11,代码来源:UITextField.cpp
示例12: UtcDaliToolkitTextFieldAssignmentOperatorP
int UtcDaliToolkitTextFieldAssignmentOperatorP(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextFieldAssignmentOperatorP");
TextField textField = TextField::New();
textField.SetProperty( TextField::Property::TEXT, "Test" );
TextField copy = textField;
DALI_TEST_CHECK( copy );
DALI_TEST_CHECK( copy.GetProperty<std::string>( TextField::Property::TEXT ) == textField.GetProperty<std::string>( TextField::Property::TEXT ) );
END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:12,代码来源:utc-Dali-TextField.cpp
示例13: UtcDaliToolkitTextFieldCopyConstructorP
int UtcDaliToolkitTextFieldCopyConstructorP(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextFieldCopyConstructorP");
TextField textField = TextField::New();
textField.SetProperty( TextField::Property::TEXT, "Test" );
TextField copy( textField );
DALI_TEST_CHECK( copy );
DALI_TEST_CHECK( copy.GetProperty<std::string>( TextLabel::Property::TEXT ) == textField.GetProperty<std::string>( TextLabel::Property::TEXT ) );
END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:12,代码来源:utc-Dali-TextField.cpp
示例14: Login
void ApplicationUI::login(){
Login *login = new Login();
TextField *emailText = navPane->findChild<TextField*>("emailText");
TextField *passwordText = navPane->findChild<TextField*>("passwordText");
bool res = QObject::connect(login, SIGNAL(userLoggedIn()), this,
SLOT(handleUserLoggedIn()));
Q_ASSERT(res);
Q_UNUSED(res);
login->loginUser(emailText->text(), passwordText->text());
}
开发者ID:ngoluan,项目名称:FlippIt-BB10,代码行数:13,代码来源:applicationui.cpp
示例15: lua_cocos2dx_TextField_addEventListener
static int lua_cocos2dx_TextField_addEventListener(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
TextField* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ccui.TextField",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<TextField*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TextField_addEventListener'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
self->addEventListener([=](cocos2d::Ref* ref,TextField::EventType eventType){
handleUIEvent(handler, ref, (int)eventType);
});
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)self, handler);
return 0;
}
luaL_error(L, "'addEventListener' function of TextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListener'.",&tolua_err);
return 0;
#endif
}
开发者ID:keith1020,项目名称:cocos.github.io,代码行数:50,代码来源:lua_cocos2dx_ui_manual.cpp
示例16: setPropsFromJsonDictionary
void TextFieldReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
{
WidgetReader::setPropsFromJsonDictionary(widget, options);
TextField* textField = static_cast<TextField*>(widget);
bool ph = DICTOOL->checkObjectExist_json(options, P_PlaceHolder);
if (ph)
{
textField->setPlaceHolder(DICTOOL->getStringValue_json(options, P_PlaceHolder,"input words here"));
}
textField->setText(DICTOOL->getStringValue_json(options, P_Text,"Text Tield"));
textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName,"微软雅黑"));
bool tsw = DICTOOL->checkObjectExist_json(options, P_TouchSizeWidth);
bool tsh = DICTOOL->checkObjectExist_json(options, P_TouchSizeHeight);
if (tsw && tsh)
{
textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, P_TouchSizeWidth), DICTOOL->getFloatValue_json(options,P_TouchSizeHeight)));
}
// float dw = DICTOOL->getFloatValue_json(options, "width");
// float dh = DICTOOL->getFloatValue_json(options, "height");
// if (dw > 0.0f || dh > 0.0f)
// {
// //textField->setSize(Size(dw, dh));
// }
bool maxLengthEnable = DICTOOL->getBooleanValue_json(options, P_MaxLengthEnable);
textField->setMaxLengthEnabled(maxLengthEnable);
if (maxLengthEnable)
{
int maxLength = DICTOOL->getIntValue_json(options, P_MaxLength,10);
textField->setMaxLength(maxLength);
}
bool passwordEnable = DICTOOL->getBooleanValue_json(options, P_PasswordEnable);
textField->setPasswordEnabled(passwordEnable);
if (passwordEnable)
{
textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, P_PasswordStyleText,"*"));
}
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
}
开发者ID:EricYT,项目名称:cocos2dx_note1,代码行数:49,代码来源:TextFieldReader.cpp
示例17: test_TextField_backspace_ime_on
static void test_TextField_backspace_ime_on()
{
TextField* t = createTextField();
toggleIme(t);
keyPress(t, 'a');
keyPress(t, 'i');
keyPress(t, KeyEvent::VKEY_BACKSPACE);
EXPECT_EQ(0, t->getCursor());
EXPECT_STR_EQ("", t->getText());
keyPress(t, KeyEvent::VKEY_ENTER);
EXPECT_EQ_TEXT_FIELD("あ", 1, t);
destroyTextField(t);
}
开发者ID:Hiroyuki-Nagata,项目名称:mona,代码行数:15,代码来源:monagui.cpp
示例18: switch
void HelloWorld::GetLoginText(cocos2d::CCObject *obj, TouchEventType eventType)
{
switch (eventType)
{
case TOUCH_EVENT_ENDED:
{
ul = (UILayer*)this->getChildByTag(10026);
TextField* LoginText = dynamic_cast<TextField*>(ul->getWidgetByName("name_TextField"));
string text = LoginText->getStringValue();
CCLOG("login text = %s",text.c_str());
}
break;
default:
break;
}
}
开发者ID:superavast,项目名称:MyFirstRepository,代码行数:16,代码来源:HelloWorldScene.cpp
示例19: CreateWindow
void Win32Painter::Create(Widget *w)
{
Button *button;
Static *label;
TextField *textField;
HINSTANCE inst = (HINSTANCE)GetWindowLong(parent_, GWL_HINSTANCE);
if ((button=dynamic_cast<Button*>(w))) {
hwnd_ = CreateWindow("BUTTON",button->Label().c_str(),WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,button->X(),button->Y(),button->Width(),button->Height(),parent_,NULL,inst,NULL);
} else if ((label=dynamic_cast<Static*>(w))) {
hwnd_ = CreateWindow("STATIC",label->Label().c_str(),WS_CHILD|WS_VISIBLE|SS_LEFT,label->X(),label->Y(),label->Width(),label->Height(),parent_,NULL,inst,NULL);
} else if ((textField=dynamic_cast<TextField*>(w))) {
hwnd_ = CreateWindow("EDIT",textField->Text().c_str(),WS_CHILD|WS_VISIBLE|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER,textField->X(),textField->Y(),textField->Width(),textField->Height(),parent_,NULL,inst,NULL);
}
originalWndProc_ = (WNDPROC)SetWindowLong(hwnd_, GWL_WNDPROC, (LONG)WndProc);
SetWindowLong(hwnd_, GWL_USERDATA, (LONG)w);
}
开发者ID:terska,项目名称:TinyUI,代码行数:17,代码来源:Win32Painter.cpp
示例20: SetPropertyMapRetrieved
bool SetPropertyMapRetrieved( TextField& field, const Property::Index property, const std::string mapKey, const std::string mapValue )
{
bool result = false;
Property::Map imageMap;
imageMap[mapKey] =mapValue;
field.SetProperty( property , imageMap );
Property::Value propValue = field.GetProperty( property );
Property::Map* resultMap = propValue.GetMap();
if ( resultMap->Find( mapKey )->Get< std::string>() == mapValue )
{
result = true;
}
return result;
}
开发者ID:mettalla,项目名称:dali,代码行数:17,代码来源:utc-Dali-TextField.cpp
注:本文中的TextField类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论