EditBox
来源:互联网 发布:软件开发外包管理制度 编辑:程序博客网 时间:2024/06/05 08:05
local sprite = ccui.Scale9Sprite:create(activeLayer:addImgFile(string.format("%sad_activity_codebg.png", activePath)))
local codeInput = ccui.EditBox:create(cc.size(350, 50), sprite,sprite,sprite)
codeInput:setPlaceholderFont(activeLayer:GetTtfFont(), 24)
codeInput:setFont(activeLayer:GetTtfFont(), 24)
if appLoc ~= 1 and appLoc ~= 16 then
codeInput:setPlaceholderFont(activeLayer:GetTtfFont(), 22)
codeInput:setFont(activeLayer:GetTtfFont(), 22)
end
codeInput:setPlaceHolder(getLocalString("input_tip", appLoc));
codeInput:setFontColor(cc.c3b(255, 255, 255))
codeInput:setMaxLength(24)
codeInput:setPosition(cc.p(cPosX,150))
bgSprite:addChild(codeInput)
local function editboxEventHandler(eventType)
if eventType == "began" then --编辑框开始编辑时调用
strFmt = string.format("editBox %p DidBegin !", codeInput)
print(strFmt)
elseif eventType == "ended" then --编辑框完成时调用
strFmt = string.format("editBox %p DidEnd !", codeInput)
print(strFmt)
elseif eventType == "return" then --编辑框return时调用
strFmt = string.format("editBox %p was returned !",codeInput)
--判断是哪个编辑框,在多个编辑框同时绑定此函数时 需判断时哪个编辑框
if codeInput == EditName then
--当编辑框EditName 按下return 时到此处
elseif codeInput == EditPassword then
--当编辑框EditPassword 按下return 时到此处
elseif codeInput == EditEmail then
--当编辑框EditEmail 按下return 时到此处
end
print(strFmt)
elseif eventType == "changed" then --编辑框内容改变时调用
strFmt = string.format("editBox %p TextChanged, text: %s ", codeInput, codeInput:getText())
print(strFmt)
end
end
codeInput:registerScriptEditBoxHandler(editboxEventHandler)
local codeInput = ccui.EditBox:create(cc.size(350, 50), sprite,sprite,sprite)
codeInput:setPlaceholderFont(activeLayer:GetTtfFont(), 24)
codeInput:setFont(activeLayer:GetTtfFont(), 24)
if appLoc ~= 1 and appLoc ~= 16 then
codeInput:setPlaceholderFont(activeLayer:GetTtfFont(), 22)
codeInput:setFont(activeLayer:GetTtfFont(), 22)
end
codeInput:setPlaceHolder(getLocalString("input_tip", appLoc));
codeInput:setFontColor(cc.c3b(255, 255, 255))
codeInput:setMaxLength(24)
codeInput:setPosition(cc.p(cPosX,150))
bgSprite:addChild(codeInput)
local function editboxEventHandler(eventType)
if eventType == "began" then --编辑框开始编辑时调用
strFmt = string.format("editBox %p DidBegin !", codeInput)
print(strFmt)
elseif eventType == "ended" then --编辑框完成时调用
strFmt = string.format("editBox %p DidEnd !", codeInput)
print(strFmt)
elseif eventType == "return" then --编辑框return时调用
strFmt = string.format("editBox %p was returned !",codeInput)
--判断是哪个编辑框,在多个编辑框同时绑定此函数时 需判断时哪个编辑框
if codeInput == EditName then
--当编辑框EditName 按下return 时到此处
elseif codeInput == EditPassword then
--当编辑框EditPassword 按下return 时到此处
elseif codeInput == EditEmail then
--当编辑框EditEmail 按下return 时到此处
end
print(strFmt)
elseif eventType == "changed" then --编辑框内容改变时调用
strFmt = string.format("editBox %p TextChanged, text: %s ", codeInput, codeInput:getText())
print(strFmt)
end
end
codeInput:registerScriptEditBoxHandler(editboxEventHandler)
阅读全文
0 0
- editbox
- EditBox
- EditBox
- editBox 过滤特定字符
- 06 EditBox 编辑框
- cocos2dx之EditBox
- EditBox多行输入
- cocos2dx editbox优化
- cocos2dx 2.x editbox
- EditBox 控件的用法
- cocos-Lua中的EditBox
- EditBox 编辑框
- EditBox的使用
- 对话框slider与EditBox关联
- Cocos2d-x3.0RC2 EditBox
- EditBox输入时自动换行
- editbox边拉变滑动改变数值
- VC++,Editbox自动滚屏
- 前端经典面试题---Ajax篇
- 【 zoj 3348 】Schedule 【网络流经典建图】
- LeetCode 404. Sum of Left Leaves
- Spring:BeanNotOfRequiredTypeException
- 学习spring
- EditBox
- Android中canvas常用方法
- struts in actin(Ted Husted 著)struts1 源码配置问题 记录
- JVM -XX: 参数介绍
- Windows下64位Apache+PHP+MySQL配置
- Button
- 《利用Python进行数据分析》笔记---第2章--1880-2010年间全美婴儿姓名
- FCN新手笔记,如何训练自己的模型
- API