挂钩 EditField 设置为 FILTER_REAL_NUMERIC 的删除键
我试图让删除键像典型的退格键一样删除字符。 MyEditField 是 EditField 的子类,常用的 EditField 包含三个方法,protected int backspace( int count, int context )
、public int backspace( int count )
和 <代码>受保护的布尔退格键()。
MyEditField 在实例化时设置为 FILTER_REAL_NUMERIC,并且我已尝试使用上述所有方法来使删除键起作用。是否需要重写退格函数才能工作,或者我是否必须编写自定义算法来获取删除键以删除字符串末尾的字符?
我已阅读文档,但找不到任何提及退格功能何时起作用以及何时不起作用的内容。另外,我知道系统(又名模拟器)正在注册删除按键,因为我可以将按键代码打印到控制台。
我正在尝试得到一些比必须通过 BB 菜单来清除整个字段更用户友好的东西。
I am trying to get the delete key remove characters like a typical backspace key. MyEditField is a subclass of EditField, and the stock EditField contains three methods, protected int backspace( int count, int context )
, public int backspace( int count )
, and protected boolean backspace()
.
MyEditField is set to FILTER_REAL_NUMERIC when instantiated, and I have tried using all the above methods to get the delete key to work. Is it necessary to override the backspace functions to get to work, or am I going to have to write a custom algorithm to get the delete key to remove a character at the end of the string?
I have read the documentation, and I could not find any mention of when the backspace functions will work and when they will not. Also, I know the system (a.k.a. simulator) is registering a key press on the delete since I can print the key code to the console.
I am trying get something more user friendly than having to go through the BB menu to clear the entire field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,不需要。只需捕获按键事件并调用
backspace()
即可。有点像:No, it isn't. Just catch the key event and call
backspace()
. Smth like: