sencha touch 实现android手机键盘对actionsheet的操作
来源:互联网 发布:虚拟教学软件 编辑:程序博客网 时间:2024/05/29 04:39
思路:
1、使用document.addEventListener("keydown",btChange,false);添加 一个键盘事件(该事件必须有一输入控件得到焦点才能触发,这个必须好好控制)
2、使用actionsheet.down('.button'),获取第一个button
3、获取后为一个button对象,使用nextSibling()、previousSibling()方法获取当前按钮对象的上一级或下一级组件(该方法能得到同一树层级中的对象)
3、使用removeCls("x-button-normal")跟addCls("x-button-action")变化按钮,实现按钮选中状态或为选中状态的视觉变化,里面的样式可自己设定
4、另外要获取第一个按钮一级最后一个按钮,以实现菜单的循环
以下为代码,可写与actionsheet的show()事件中,实现监听android手机键盘
var bt_checkvar bt_firstvar bt_lastbt_check = comp.down('.button')bt_first = comp.down('.button')bt_last = comp.down('.button').nextSibling().nextSibling().nextSibling().nextSibling()bt_check.removeCls("x-button-normal");bt_check.addCls("x-button-action");document.addEventListener("keydown",btChange,false);function btChange(){var e = window.event.keyCode;if(e == 56 || e == 54){var bt_check_next = bt_check.nextSibling() //返回该组件之后的组件(处于同一树层级中)if(bt_check_next){bt_check.removeCls("x-button-action");bt_check.addCls("x-button-normal");bt_check_next.removeCls("x-button-normal");bt_check_next.addCls("x-button-action");bt_check = bt_check_next}else{bt_check.removeCls("x-button-action");bt_check.addCls("x-button-normal");bt_check = bt_first;bt_check.removeCls("x-button-normal");bt_check.addCls("x-button-action");}}else if(e == 50 || e == 52){var bt_check_previous = bt_check.previousSibling() //返回该组件之前的组件(处于同一树层级中)if(bt_check_previous){bt_check.removeCls("x-button-action");bt_check.addCls("x-button-normal");bt_check_previous.removeCls("x-button-normal");bt_check_previous.addCls("x-button-action");bt_check = bt_check_previous}else{bt_check.removeCls("x-button-action");bt_check.addCls("x-button-normal");bt_check = bt_last;bt_check.removeCls("x-button-normal");bt_check.addCls("x-button-action");}}else if(e == 13 || e == 53){bt_check.callHandler() //触发按钮的handler事件}}
0 0
- sencha touch 实现android手机键盘对actionsheet的操作
- sencha touch 实现键盘对list的操作
- sencha touch 添加类似phoneGap的android键盘监听事件
- sencha touch 简单实现手机点菜菜单
- 手机上的HTML5框架 Sencha Touch
- [Phonegap+Sencha Touch] 移动开发68 Sencha Touch弹出键盘挡住输入框的解决办法
- Sencha touch 对store操作心得——Sencha Touch 数据层篇 Store
- sencha touch 搜索功能search的实现
- sencha touch实现分页
- android,sencha touch 学习
- sencha-touch的使用
- Sencha Touch 的基础知识
- Sencha Touch 自定义List的三种实现方案
- sencha touch中实现页面之间的互相跳转
- sencha-touch下借助phoneGap实现拍照,二维码的功能
- sencha touch 中实现一个view的刷新
- sencha-touch下借助phoneGap实现拍照,二维码的功能
- Sencha Touch实现点击Panel,切换带图片的Panel
- hadoop2.2.0分布模式安装教程
- 怎样给宝宝取个小名
- STL基础
- getBoundClientRect函数详解
- js+css做的树实例
- sencha touch 实现android手机键盘对actionsheet的操作
- raw_input() 与 input() __ Python
- Eclipse用法和技巧专栏
- Linux系统中vi命令失效
- TCP的滑动窗口与拥塞窗口
- MySQL查看table的engine
- 荷花语汇瓷砖背景墙 打造出水芙蓉的客厅
- BlueTooth: 蓝牙音频音质探讨
- CSS动画设置