• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UITextField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中UITextField的典型用法代码示例。如果您正苦于以下问题:C++ UITextField类的具体用法?C++ UITextField怎么用?C++ UITextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UITextField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: StringToWString

bool AutotestingSystemLua::CheckMsgText(UIControl *control, const String &key)
{
	WideString expectedText = StringToWString(key);
	//TODO: check key in localized strings for Lua
	expectedText = autotestingLocalizationSystem->GetLocalizedString(expectedText);

	UIStaticText *uiStaticText = dynamic_cast<UIStaticText*>(control);
	if(uiStaticText)
	{
		WideString actualText = uiStaticText->GetText();
		Log("DEBUG", Format("Compare text in control %s with text by key %s", uiStaticText->GetName().c_str(), key.c_str()));
		Log("DEBUG", WStringToString(actualText));
		Log("DEBUG", WStringToString(expectedText));
		return (actualText == expectedText);
	}
	UITextField *uiTextField = dynamic_cast<UITextField*>(control);
	if(uiTextField)
	{
		WideString actualText = uiTextField->GetText();
		Log("DEBUG", Format("Compare text in control %s with text by key %s", uiTextField->GetName().c_str(), key.c_str()));
		Log("DEBUG", WStringToString(actualText));
		Log("DEBUG", WStringToString(expectedText));
		return (actualText == expectedText);
	}
	return false;
}
开发者ID:galek,项目名称:dava.framework,代码行数:26,代码来源:AutotestingSystemLua.cpp


示例2: switch

void UITextFieldTest::textFieldEvent(CCObject *pSender, TextFiledEventType type)
{
    switch (type)
    {
        case TEXTFIELD_EVENT_ATTACH_WITH_IME:
        {
            UITextField* textField = dynamic_cast<UITextField*>(pSender);
            CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
            textField->runAction(CCMoveTo::create(0.225,
                                                  ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2)));
            m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME")->getCString());
        }
            break;
            
        case TEXTFIELD_EVENT_DETACH_WITH_IME:
        {
            UITextField* textField = dynamic_cast<UITextField*>(pSender);
            CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
            textField->runAction(CCMoveTo::create(0.175, ccp(screenSize.width / 2.0f, screenSize.height / 2.0f)));
            m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME")->getCString());
        }
            break;
            
        case TEXTFIELD_EVENT_INSERT_TEXT:
            m_pDisplayValueLabel->setText(CCString::createWithFormat("insert words")->getCString());
            break;
            
        case TEXTFIELD_EVENT_DELETE_BACKWARD:
            m_pDisplayValueLabel->setText(CCString::createWithFormat("delete word")->getCString());
            break;
            
        default:
            break;
    }
}
开发者ID:2193q,项目名称:cocos2d-x,代码行数:35,代码来源:UITextFieldTest.cpp


示例3: lua_cocos2dx_UITextField_addEventListenerTextField

static int lua_cocos2dx_UITextField_addEventListenerTextField(lua_State* L)
{
    if (nullptr == L)
        return 0;
    
    int argc = 0;
    UITextField* self = nullptr;
    
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
	if (!tolua_isusertype(L,1,"UITextField",0,&tolua_err)) goto tolua_lerror;
#endif
    
    self = static_cast<UITextField*>(tolua_tousertype(L,1,0));
    
#if COCOS2D_DEBUG >= 1
	if (nullptr == self) {
		tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_UITextField_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::EVENT_LISTENER);
        
        self->setUserObject(listener);        
        self->addEventListenerTextField(listener, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
        
        return 0;
    }
    
    CCLOG("'addEventListenerTextField' function of UITextField 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:CryQ,项目名称:coclua,代码行数:57,代码来源:lua_cocos2dx_coco_studio_manual.cpp


示例4: UITextField

UITextField* UITextField::create()
{
    UITextField* widget = new UITextField();
    if (widget && widget->init())
    {
        return widget;
    }
    CC_SAFE_DELETE(widget);
    return NULL;
}
开发者ID:edwardZhang,项目名称:Cocos2d-x-For-CocoStudio,代码行数:10,代码来源:UITextField.cpp


示例5: detachWithIMEEvent

void CocosGUIExamplesRegisterScene::detachWithIMEEvent(CCObject *pSender)
{
    UITextField* textField = dynamic_cast<UITextField*>(pSender);    
    
    if (strcmp(textField->getName(), "password agin_TextField") == 0)
    {
        CCMoveBy* moveBy = CCMoveBy::create(0.1f, ccp(0, -textField->getContentSize().height));
        m_pLayout->runAction(moveBy);
    }
}
开发者ID:2uemg8sq98r3,项目名称:cocos2d-x,代码行数:10,代码来源:CocosGUIExamplesRegisterScene.cpp


示例6: UITextField

UITextField *LandscapeToolsPanelHeightmap::CreateTextField(const Rect &rect)
{
    Font * font = ControlsFactory::GetFontLight();
    UITextField *tf = new UITextField(rect);
    ControlsFactory::CustomizeEditablePropertyCell(tf);
    tf->SetFont(font);
    tf->SetDelegate(this);
    
    return tf;
}
开发者ID:dima-belsky,项目名称:dava.framework,代码行数:10,代码来源:LandscapeToolsPanelHeightmap.cpp


示例7: coco_TextFieldInsertTextSelector

void TartarLayer::onEnter()
{
    CCLayer::onEnter();

    UiManager::Singleton().Init(this);
    UiManager::Singleton().SetupWidget("../UIProject/Json/Tartar.json");

    UIWidget* pUIWidget = UiManager::Singleton().GetChildByName("Panel1");
    pUIWidget->setVisible(true);
    pUIWidget = UiManager::Singleton().GetChildByName("Panel2");
    pUIWidget->setVisible(false);

    UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
    pUILabel->setVisible(false);
    
    pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_DayDiff"));
    pUILabel->setVisible(false);

    pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_PastDay"));
    pUILabel->setVisible(false);

    UITextField* pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Year"));
    pUITextField->setMaxLengthEnable(true);
    pUITextField->setMaxLength(4);
    pUITextField->addInsertTextEvent(this, coco_TextFieldInsertTextSelector(TartarLayer::TextFieldInserted));
    
    pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Mon"));
    pUITextField->setMaxLengthEnable(true);
    pUITextField->setMaxLength(2);
    pUITextField->addInsertTextEvent(this, coco_TextFieldInsertTextSelector(TartarLayer::TextFieldInserted));

    pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Day"));
    pUITextField->setMaxLengthEnable(true);
    pUITextField->setMaxLength(2);
    pUITextField->addInsertTextEvent(this, coco_TextFieldInsertTextSelector(TartarLayer::TextFieldInserted));

    UIButton* pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Start"));
    pButton->addReleaseEvent(this, coco_releaseselector(TartarLayer::BottonOKClicked));

    pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Finish"));
    pButton->addReleaseEvent(this, coco_releaseselector(TartarLayer::BottonFinishClicked));

    pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Order"));
    pButton->addReleaseEvent(this, coco_releaseselector(TartarLayer::BottonOrderClicked));

    UILabel* pUILabelWarning = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_NeedCheck"));
    pUILabelWarning->setVisible(false);

    UIImageView* pImage = DynamicCast<UIImageView*>(UiManager::Singleton().GetChildByName("ImageView"));
    CCRect rect = pImage->getRect();
    float normalWidth = cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width - 10.0f;
    float normalHeight = normalWidth * 0.6f;
    pImage->setScaleX(normalWidth / rect.size.width * pImage->getScaleX());
    pImage->setScaleY(normalHeight / rect.size.height * pImage->getScaleY());
}
开发者ID:hanxu101,项目名称:projectx,代码行数:55,代码来源:SceneTartar.cpp


示例8: SetText

bool AutotestingSystemLua::SetText(const String &path, const String &text)
{
    Logger::Debug("AutotestingSystemLua::SetText %s %s", path.c_str(), text.c_str());
    UITextField *tf = dynamic_cast<UITextField*>(FindControl(path));
    if(tf)
    {
        tf->SetText(StringToWString(text));
        return true;
    }
    return false;
}
开发者ID:galek,项目名称:dava.framework,代码行数:11,代码来源:AutotestingSystemLua.cpp


示例9: GetText

String AutotestingSystemLua::GetText(UIControl *control)
{
	Logger::Debug("AutotestingSystemLua::GetText =%s", control->GetName().c_str());
	UIStaticText *uiStaticText = dynamic_cast<UIStaticText*>(control);
	if(uiStaticText)
	{
		return UTF8Utils::EncodeToUTF8(uiStaticText->GetText());
	}
	UITextField *uiTextField = dynamic_cast<UITextField*>(control);
	if(uiTextField)
	{
		return UTF8Utils::EncodeToUTF8(uiTextField->GetText());
	}
	return "";
}
开发者ID:galek,项目名称:dava.framework,代码行数:15,代码来源:AutotestingSystemLua.cpp


示例10: TextFieldInserted

void TartarLayer::TextFieldInserted( CCObject* pSender )
{
    UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
    pUILabel->setVisible(false);

    UITextField* pUITextField = DynamicCast<UITextField*>(pSender);
    std::string str = pUITextField->getStringValue();
    if (str.size() > 0)
    {
        char lastLetter = str[str.size()-1];
        if (lastLetter < '0' || lastLetter > '9')
        {
            str.pop_back();
            pUITextField->setText(str.c_str());
        }
    }
}
开发者ID:hanxu101,项目名称:projectx,代码行数:17,代码来源:SceneTartar.cpp


示例11: SendEvent

void UI::HandleUpdate(StringHash eventType, VariantMap& eventData)
{
    if (exitRequested_) {
        SendEvent(E_EXITREQUESTED);
        exitRequested_ = false;
        return;
    }
    
    tooltipHoverTime_ += eventData[Update::P_TIMESTEP].GetFloat();

    if (tooltipHoverTime_ >= 0.5f)
    {
        UIWidget* hoveredWidget = GetHoveredWidget();
        if (hoveredWidget && !tooltip_ && (hoveredWidget->GetShortened() || hoveredWidget->GetTooltip().Length() > 0))
        {
            tooltip_ = new UIPopupWindow(context_, true, hoveredWidget, "tooltip");
            UILayout* tooltipLayout = new UILayout(context_, UI_AXIS_Y, true);
            if (hoveredWidget->GetShortened())
            {
                UITextField* fullTextField = new UITextField(context_, true);
                fullTextField->SetText(hoveredWidget->GetText());
                tooltipLayout->AddChild(fullTextField);
            }
            if (hoveredWidget->GetTooltip().Length() > 0)
            {
                UITextField* tooltipTextField = new UITextField(context_, true);
                tooltipTextField->SetText(hoveredWidget->GetTooltip());
                tooltipLayout->AddChild(tooltipTextField);
            }
            Input* input = GetSubsystem<Input>();
            IntVector2 mousePosition = input->GetMousePosition();
            tooltip_->AddChild(tooltipLayout);
            tooltip_->Show(mousePosition.x_ + 8, mousePosition.y_ + 8);
        }
    }
    else 
    {
        if (tooltip_) tooltip_->Close();
    }

    SendEvent(E_UIUPDATE);
    TBMessageHandler::ProcessMessages();
}
开发者ID:marynate,项目名称:AtomicGameEngine,代码行数:43,代码来源:UI.cpp


示例12: CopyDataFrom

void UITextField::CopyDataFrom(UIControl *srcControl)
{
	UIControl::CopyDataFrom(srcControl);
	UITextField* t = (UITextField*) srcControl;
		
	cursorTime = t->cursorTime;
    showCursor = t->showCursor;
	SetText(t->text);
	SetRect(t->GetRect());
	
	cursorBlinkingTime = t->cursorBlinkingTime;
	if (t->staticText)
	{
		staticText = (UIStaticText*)t->staticText->Clone();
		AddControl(staticText);
	}
	if (t->textFont)
		SetFont(t->textFont);
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:19,代码来源:UITextField.cpp


示例13: InitializeControl

// Initialize the control(s) attached.
void UITextFieldMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
    UIControlMetadata::InitializeControl(controlName, position);
    
    int paramsCount = this->GetParamsCount();
    for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
    {
        UITextField* textField = dynamic_cast<UITextField*>(this->treeNodeParams[i].GetUIControl());
        
        textField->SetFont(EditorFontManager::Instance()->GetDefaultFont());
        textField->GetBackground()->SetDrawType(UIControlBackground::DRAW_ALIGNED);
        
        // Initialize both control text and localization key.
        WideString controlText = StringToWString(textField->GetName());
        
        HierarchyTreeNode* activeNode = GetTreeNode(i);
        textField->SetText(controlText);
        
        activeNode->GetExtraData().SetLocalizationKey(controlText, this->GetReferenceState());
    }
}
开发者ID:,项目名称:,代码行数:22,代码来源:


示例14: WStringToString

bool AutotestingSystemLua::CheckText(UIControl *control, const String &expectedText)
{
	UIStaticText *uiStaticText = dynamic_cast<UIStaticText*>(control);
	if(uiStaticText)
	{
		String actualText = WStringToString(uiStaticText->GetText());
		Log("DEBUG", Format("Compare text in control %s with expected text", uiStaticText->GetName().c_str()));
		Log("DEBUG", actualText);
		Log("DEBUG", expectedText);
		return (actualText == expectedText);
	}
	UITextField *uiTextField = dynamic_cast<UITextField*>(control);
	if(uiTextField)
	{
		String actualText = WStringToString(uiTextField->GetText());
		Log("DEBUG", Format("Compare text in control %s with expected text", uiTextField->GetName().c_str()));
		Log("DEBUG", actualText);
		Log("DEBUG", expectedText);
		return (actualText == expectedText);
	}
	return false;
}
开发者ID:galek,项目名称:dava.framework,代码行数:22,代码来源:AutotestingSystemLua.cpp


示例15: copySpecialProperties

void UITextField::copySpecialProperties(UIWidget *widget)
{
    UITextField* textField = dynamic_cast<UITextField*>(widget);
    if (textField)
    {
        setText(textField->m_pTextFieldRenderer->getString());
        setPlaceHolder(textField->getStringValue());
        setFontSize(textField->m_pTextFieldRenderer->getFontSize());
        setFontName(textField->m_pTextFieldRenderer->getFontName());
        setMaxLengthEnabled(textField->isMaxLengthEnabled());
        setMaxLength(textField->getMaxLength());
        setPasswordEnabled(textField->isPasswordEnabled());
        setPasswordStyleText(textField->m_strPasswordStyleText.c_str());
        setAttachWithIME(textField->getAttachWithIME());
        setDetachWithIME(textField->getDetachWithIME());
        setInsertText(textField->getInsertText());
        setDeleteBackward(textField->getDeleteBackward());
    }
}
开发者ID:ShortTailLab,项目名称:cocos2d-x,代码行数:19,代码来源:UITextField.cpp


示例16: textfieldeventselector

bool UITextFieldTest_Password::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
        
        // Add a label in which the textfield events will be displayed
        m_pDisplayValueLabel = UILabel::create();
        m_pDisplayValueLabel->setText("No Event");
        m_pDisplayValueLabel->setFontName("Marker Felt");
        m_pDisplayValueLabel->setFontSize(32);
        m_pDisplayValueLabel->setAnchorPoint(ccp(0.5f, -1));
        m_pDisplayValueLabel->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + m_pDisplayValueLabel->getSize().height * 1.5));
        m_pUiLayer->addWidget(m_pDisplayValueLabel);
        
        // Add the alert
        UILabel *alert = UILabel::create();
        alert->setText("TextField password");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getSize().height * 3.0f));
        m_pUiLayer->addWidget(alert);
        
        // Create the textfield
        UITextField* textField = UITextField::create();
        textField->setPasswordEnabled(true);
        textField->setPasswordStyleText("*");
        textField->setTouchEnabled(true);
        textField->setFontName("Marker Felt");
        textField->setFontSize(30);
        textField->setPlaceHolder("input password here");
        textField->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
        textField->addEventListenerTextField(this, textfieldeventselector(UITextFieldTest_Password::textFieldEvent));
        m_pUiLayer->addWidget(textField);
        
        return true;
    }
    return false;
}
开发者ID:2193q,项目名称:cocos2d-x,代码行数:40,代码来源:UITextFieldTest.cpp


示例17: atoi

void TartarLayer::BottonOKClicked( CCObject* pSender )
{
    // Check date Format is correct or not
    bool dateFormatIsValid = true;
    UITextField* pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Year"));
    int year = atoi(pUITextField->getStringValue());
    int mon = 0;
    int day = 0;
    if (year != 2013)
    {
        dateFormatIsValid = false;
    }
    if (dateFormatIsValid)
    {
        pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Mon"));
        mon = atoi(pUITextField->getStringValue());
        if (mon < 1 || mon > 12)
        {
            dateFormatIsValid = false;
        }
    }
    if (dateFormatIsValid)
    {
        pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Day"));
        day = atoi(pUITextField->getStringValue());
        if (day < 1 || day > 31)
        {
            dateFormatIsValid = false;
        }
    }
    
    if (!dateFormatIsValid)
    {
        UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
        pUILabel->setVisible(true);
    }
    else
    {
        // Get Current Date
        tm curTime = GetDate();
        curTime.tm_hour = 0;
        curTime.tm_min = 0;
        curTime.tm_sec = 0;

        tm inputTime;
        inputTime.tm_year = year;
        inputTime.tm_mon = mon;
        inputTime.tm_mday = day;

        int dayDiff = GetElapseDayNum(curTime, inputTime);
        if (dayDiff < 0)
        {
            UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
            pUILabel->setVisible(true);
        }
        else
        {
            UIWidget* pUIWidget = UiManager::Singleton().GetChildByName("Panel1");
            pUIWidget->setVisible(false);
            pUIWidget = UiManager::Singleton().GetChildByName("Panel2");
            pUIWidget->setVisible(true);

            UILabel* pUILabelDayDiff = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_DayDiff"));
            char str[10];
            sprintf(str,"%d",dayDiff);
            pUILabelDayDiff->setText(str);
            pUILabelDayDiff->setVisible(true);

            pUILabelDayDiff = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_PastDay"));
            pUILabelDayDiff->setVisible(true);

            // Request info according the diffDay.
            CCHttpRequest* request = new CCHttpRequest();
            std::string url = "http://localhost:8000/plaque/" + std::string(str);
            request->setUrl(url.c_str());
            request->setRequestType(CCHttpRequest::kHttpGet);
            request->setResponseCallback(this, httpresponse_selector(TartarLayer::onHttpRequestCompleted));
            request->setTag("GET INFO");
            CCHttpClient::getInstance()->send(request);
            request->release();
        }
    }
}
开发者ID:hanxu101,项目名称:projectx,代码行数:83,代码来源:SceneTartar.cpp


示例18: UITextField

UIControl* UITextField::Clone()
{
	UITextField *t = new UITextField();
	t->CopyDataFrom(this);
	return t;
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:6,代码来源:UITextField.cpp


示例19: UIPopupWindow


//.........这里部分代码省略.........
        return container;
    }

    if (widget->IsOfType<TBSelectDropdown>())
    {
        UISelectDropdown* select = new UISelectDropdown(context_, false);
        select->SetWidget(widget);
        WrapWidget(select, widget);
        return select;
    }

    if (widget->IsOfType<TBPulldownMenu>())
    {
        UIPulldownMenu* select = new UIPulldownMenu(context_, false);
        select->SetWidget(widget);
        WrapWidget(select, widget);
        return select;
    }

    if (widget->IsOfType<TBButton>())
    {
        // don't wrap the close button of a TBWindow.close
        if (widget->GetID() == TBIDC("TBWindow.close"))
            return 0;

        UIButton* button = new UIButton(context_, false);
        button->SetWidget(widget);
        WrapWidget(button, widget);
        return button;
    }

    if (widget->IsOfType<TBTextField>())
    {
        UITextField* textfield = new UITextField(context_, false);
        textfield->SetWidget(widget);
        WrapWidget(textfield, widget);
        return textfield;
    }

    if (widget->IsOfType<TBEditField>())
    {
        UIEditField* editfield = new UIEditField(context_, false);
        editfield->SetWidget(widget);
        WrapWidget(editfield, widget);
        return editfield;
    }

    if (widget->IsOfType<TBSkinImage>())
    {
        UISkinImage* skinimage = new UISkinImage(context_, "", false);
        skinimage->SetWidget(widget);
        WrapWidget(skinimage, widget);
        return skinimage;
    }

    if (widget->IsOfType<TBImageWidget>())
    {
        UIImageWidget* imagewidget = new UIImageWidget(context_, false);
        imagewidget->SetWidget(widget);
        WrapWidget(imagewidget, widget);
        return imagewidget;
    }
    if (widget->IsOfType<TBClickLabel>())
    {
        UIClickLabel* nwidget = new UIClickLabel(context_, false);
        nwidget->SetWidget(widget);
开发者ID:abandonrules,项目名称:AtomicGameEngine,代码行数:67,代码来源:UI.cpp


示例20: KeyPress

void AutotestingSystemLua::KeyPress(int32 keyChar)
{
	UITextField *uiTextField = dynamic_cast<UITextField*>(UIControlSystem::Instance()->GetFocusedControl()); 
	if (uiTextField)
	{
		UIEvent keyPress;
		keyPress.tid = keyChar;
		keyPress.phase = UIEvent::PHASE_KEYCHAR;
		keyPress.tapCount = 1;
		keyPress.keyChar = keyChar;

		Logger::Debug("AutotestingSystemLua::KeyPress %d phase=%d count=%d point=(%f, %f) physPoint=(%f,%f) key=%c", keyPress.tid, keyPress.phase, keyPress.tapCount, keyPress.point.x, keyPress.point.y, keyPress.physPoint.x, keyPress.physPoint.y, keyPress.keyChar);

		if (keyPress.tid == DVKEY_BACKSPACE)
		{
			//TODO: act the same way on iPhone
			WideString str = L"";
			if(uiTextField->GetDelegate()->TextFieldKeyPressed(uiTextField, (int32)uiTextField->GetText().length(), -1, str))
			{
				uiTextField->SetText(uiTextField->GetAppliedChanges((int32)uiTextField->GetText().length(),  -1, str));
			}
			
		}
		else if (keyPress.tid == DVKEY_ENTER)
		{
			uiTextField->GetDelegate()->TextFieldShouldReturn(uiTextField);
		}
		else if (keyPress.tid == DVKEY_ESCAPE)
		{
			uiTextField->GetDelegate()->TextFieldShouldCancel(uiTextField);
		}
		else if(keyPress.keyChar != 0)
		{
			WideString str;
			str += keyPress.keyChar;
			if(uiTextField->GetDelegate()->TextFieldKeyPressed(uiTextField, (int32)uiTextField->GetText().length(), 1, str))
			{
				uiTextField->SetText(uiTextField->GetAppliedChanges((int32)uiTextField->GetText().length(),  1, str));
			}
		}
	}
}
开发者ID:galek,项目名称:dava.framework,代码行数:42,代码来源:AutotestingSystemLua.cpp



注:本文中的UITextField类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UITree类代码示例发布时间:2022-05-31
下一篇:
C++ UIStaticText类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap