GWT UiBinder:将鼠标处理程序添加到面板或网格
我找不到将鼠标处理程序添加到 GWT 面板或网格的方法 在使用 UiBinder 时。
我基本上需要一种可以在网格上检测以下内容的方法:
- 检测正在发生事件的单元格。
- 检测鼠标弹起事件
- 检测鼠标按下事件
- 检测鼠标移出事件
- 检测鼠标悬停事件
我计划尝试使用绝对面板覆盖在 网格的顶部。我可以在 AbsolutePanel 上检测到这些事件, 然后根据事件发生的位置,确定哪个单元格 如果没有 AbsolutePanel,事件就会发生 覆盖在网格顶部,然后进行相应的操作。我现在发现 在术语上对面板施加完全相同的限制 点击处理程序,并且没有太多选项。
我只需要找到一种方法让上述事件在网格上运行。 你会推荐什么?没有使用 UiBinder,我使用的是 DomHandlers, 这似乎在 UiBinder 中被禁用(我错了吗?)。
非常感谢任何帮助。谢谢!
〜斯科特
I can't find a way to add a Mouse Handler to a GWT Panel or a Grid
while using UiBinder.
I basically need a way that I can detect the following over a Grid:
- Detect what cell the event is happening in.
- Detect Mouse Up Event
- Detect Mouse Down Event
- Detect Mouse Out Event
- Detect Mouse Over Event
I had planned to try and do this with the absolute panel overlayed on
top of the Grid. I could detect these events on the AbsolutePanel,
then based off of the location of the event, determine what cell the
event would have taken place in had the AbsolutePanel not have been
overlayed on top of the Grid, and then act accordingly. I now find out
that the exact same restrictions are placed upon the panels in terms
of click handlers, and don't have many options.
I just need to find a way to get the above events to work on the Grid.
What would you recommend? Not using UiBinder, I was using DomHandlers,
which seem to be disabled in UiBinder (am I wrong?).
Any help is VERY appreciated. Thanks!
~Scott
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以扩展 Grid 并让它实现适当的接口,例如:
然后在模板中使用它
并在所属类中添加处理程序
希望它有所帮助。
You could extend Grid and have it implement appropriate interfaces like:
and then use it in template
and add handler in owning class
Hope it helps.
...或者简单地将
Grid
放置在FocusPanel
中:...or simply place the
Grid
inside aFocusPanel
: