本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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 );
}
示例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);
}