当前位置: 首页>>代码示例>>C++>>正文


C++ CCEditBox::getScriptEditBoxHandler方法代码示例

本文整理汇总了C++中CCEditBox::getScriptEditBoxHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ CCEditBox::getScriptEditBoxHandler方法的具体用法?C++ CCEditBox::getScriptEditBoxHandler怎么用?C++ CCEditBox::getScriptEditBoxHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCEditBox的用法示例。


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

示例1: openKeyboard

void CCEditBoxImplWin::openKeyboard()
{
    if (m_pDelegate != NULL)
    {
        m_pDelegate->editBoxEditingDidBegin(m_pEditBox);
    }
    
    CCEditBox* pEditBox = this->getCCEditBox();
    if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
        pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
    }
    
	std::string placeHolder = m_pLabelPlaceHolder->getString();
	if (placeHolder.length() == 0)
		placeHolder = "Enter value";

	char pText[100]= {0};
	std::string text = getText();
	if (text.length())
		strncpy(pText, text.c_str(), 100);
	bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), pText, 100, false) == IDOK;
	
	if (didChange) 	
		setText(pText);

	if (m_pDelegate != NULL) {
		if (didChange)
			m_pDelegate->editBoxTextChanged(m_pEditBox, getText());
		m_pDelegate->editBoxEditingDidEnd(m_pEditBox);
		m_pDelegate->editBoxReturn(m_pEditBox);
	}
}
开发者ID:1vs1,项目名称:quick-cocos2d-x,代码行数:34,代码来源:CCEditBoxImplWin.cpp

示例2: editBoxCallbackFunc

static void editBoxCallbackFunc(const char* pText, void* ctx)
{
    CCEditBoxImplAndroid* thiz = (CCEditBoxImplAndroid*)ctx;
    thiz->setText(pText);
	
    if (thiz->getDelegate() != NULL)
    {
        thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
        thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
        thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
    }
    
    CCEditBox* pEditBox = thiz->getCCEditBox();
    if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();

        cocos2d::extension::KeyboardReturnType returnType = pEditBox->getReturnType();
        int handler = pEditBox->getScriptEditBoxHandler();
        pEngine->executeEvent(handler, "changed",pEditBox);

        if (returnType == cocos2d::extension::kKeyboardReturnTypeDone)
        {
            pEngine->executeEvent(handler, "returnDone", pEditBox);
    }
        else if (returnType == cocos2d::extension::kKeyboardReturnTypeSend)
        {
            pEngine->executeEvent(handler, "returnSend", pEditBox);
}
        else if (returnType == cocos2d::extension::kKeyboardReturnTypeSearch)
        {
            pEngine->executeEvent(handler, "returnSearch", pEditBox);
        }
        else if (returnType == cocos2d::extension::kKeyboardReturnTypeGo)
        {
            pEngine->executeEvent(handler, "returnGo", pEditBox);
        }
        else
        {
            pEngine->executeEvent(handler, "return", pEditBox);
        }
        pEngine->executeEvent(handler, "ended",pEditBox);
    }
}
开发者ID:fordream,项目名称:quick,代码行数:44,代码来源:CCEditBoxImplAndroid.cpp

示例3: editBoxCallbackFunc

static void editBoxCallbackFunc(const char* pText, void* ctx)
{
    CCEditBoxImplTizen* thiz = (CCEditBoxImplTizen*)ctx;
    thiz->setText(pText);

    if (thiz->getDelegate() != NULL)
    {
        thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
        thiz->getDelegate()->editBoxEditingDidEnd(thiz->getCCEditBox());
        thiz->getDelegate()->editBoxReturn(thiz->getCCEditBox());
    }
    
    CCEditBox* pEditBox = thiz->getCCEditBox();
    if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
        pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox);
        pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox);
        pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "return",pEditBox);
    }
}
开发者ID:pes6pro,项目名称:visva,代码行数:21,代码来源:CCEditBoxImplTizen.cpp

示例4: openKeyboard

void CCEditBoxImplAndroid::openKeyboard()
{
    if (m_pDelegate != NULL)
    {
        m_pDelegate->editBoxEditingDidBegin(m_pEditBox);
    }
    CCEditBox* pEditBox = this->getCCEditBox();
    if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
        pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
    }
	
    showEditTextDialogJNI(  m_strPlaceHolder.c_str(),
						  m_strText.c_str(),
						  m_eEditBoxInputMode,
						  m_eEditBoxInputFlag,
						  m_eKeyboardReturnType,
						  m_nMaxLength,
						  editBoxCallbackFunc,
						  (void*)this  );
	
}
开发者ID:fordream,项目名称:quick,代码行数:23,代码来源:CCEditBoxImplAndroid.cpp

示例5: openKeyboard

void CCEditBoxImplTizen::openKeyboard()
{
    if (m_pDelegate != NULL)
    {
        m_pDelegate->editBoxEditingDidBegin(m_pEditBox);
    }
    CCEditBox* pEditBox = this->getCCEditBox();
    if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler())
    {
        cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
        pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
    }

    KeypadStyle keypadStyle = KEYPAD_STYLE_NORMAL;
    KeypadInputModeCategory keypadCategory = KEYPAD_MODE_ALPHA;
    bool bSingleLineEnabled = false;
    switch (m_eEditBoxInputMode)
    {
    case kEditBoxInputModeAny:
        keypadStyle = KEYPAD_STYLE_NORMAL;
        break;
    case kEditBoxInputModeEmailAddr:
        keypadStyle = KEYPAD_STYLE_EMAIL;
        break;
    case kEditBoxInputModeNumeric:
    case kEditBoxInputModeDecimal:
        keypadStyle = KEYPAD_STYLE_NUMBER;
        keypadCategory = KEYPAD_MODE_NUMERIC;
        break;
    case kEditBoxInputModePhoneNumber:
        keypadStyle = KEYPAD_STYLE_PHONE_NUMBER;
        break;
    case kEditBoxInputModeUrl:
        keypadStyle = KEYPAD_STYLE_URL;
        break;
    case kEditBoxInputModeSingleLine:
        bSingleLineEnabled = true;
        break;
    default:
        keypadStyle = KEYPAD_STYLE_NORMAL;
        break;
    }

    bool bTextPrediction = true;
    switch (m_eEditBoxInputFlag)
    {
    case kEditBoxInputFlagPassword:
        keypadStyle = KEYPAD_STYLE_PASSWORD;
        break;
    case kEditBoxInputFlagSensitive:
        bTextPrediction = false;
        break;
    default:
        break;
    }

    ((CCOspForm *)CCOspApplication::GetInstance()->getCCOspForm())->ShowKeypad(
        m_strText.c_str(),
        keypadStyle,
        keypadCategory,
        bSingleLineEnabled,
        bTextPrediction,
        m_nMaxLength,
        editBoxCallbackFunc,
        (void*)this);
}
开发者ID:pes6pro,项目名称:visva,代码行数:66,代码来源:CCEditBoxImplTizen.cpp


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