SWT:完成后的按键事件
我正在创建一个文本框,自动完成列表中的输入。例如,如果您输入 345
,它可能会检查列表并找到 345678
,然后文本框中有 345
,然后是 678
突出显示。
http://nucleussystems.com/files/Screenshot.png
这样,如果您继续输入有所不同,它会删除自动附加的文本。
我尝试使用 keyReleased 事件来执行此操作,但如果一次按下多个键(快速打字时很常见),则会出现用户体验问题。但我很快发现 keyPressed 事件在调用事件处理程序之前不会添加键入的文本。
因此,我需要找到一种方法来在 SWT 处理事件处理程序之后触发它。这可能吗?
I'm creating a text box that automatically completes the input from a list. For example, if you enter 345
, it might check the list and find 345678
, and then the text box has 345
, and then 678
highlighted.
http://nucleussystems.com/files/Screenshot.png
This way, if you continue typing something different, it removes the automatically appended text.
I tried doing it with the keyReleased event, but there were user experience problems if more than one key was pressed at a time (something very common when typing fast). But I soon found out that the keyPressed event doesn't add the text typed until after the event handler(s) is/are called.
So I need to find out a way to fire my event handler after SWT has handled it. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 SWT.Modify 事件可以提供您所需要的。查看 ModifyListener 文档。
I think SWT.Modify event can provide what you need. Have a look at the ModifyListener documentation.