子菜单中的GWT MenuItem具有零getAbsoluteTop()getAbsoluteLeft() [英] GWT MenuItem in a submenu has zero getAbsoluteTop() getAbsoluteLeft()
问题描述
我试图找到给定菜单项(在下拉垂直菜单中)在屏幕上的位置,但是 即使菜单项显示在屏幕上,getAbsoluteTop()getAbsoluteLeft()均为零
I'm trying to find where a given menu item (which is within a drop down vertical menu) is located on the screen but getAbsoluteTop() getAbsoluteLeft() are zero even when the menu item is showing on the screen
顺便说一句,实际的元素似乎是
The actual Element by the way seems to be
请问我如何找到菜单项(在浮动下拉菜单中)在屏幕上的位置?
Any idea how I can find where a menu item (within a floating drop down menu) is on the screen please?
谢谢!
推荐答案
最有可能,您要求在菜单项完全呈现之前输入坐标.尝试使用调度程序( GWT:计时器和调度程序类)等待直到菜单项完全呈现,然后在execute
方法内询问坐标.
Most likely, you ask for the coordinates before the menu item is fully rendered. Try using a Scheduler (GWT: Timer and Scheduler Classes) to wait until the menu item is fully rendered and then ask for the coordinates inside the execute
method.
这篇关于子菜单中的GWT MenuItem具有零getAbsoluteTop()getAbsoluteLeft()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!