GWT MenuItem in a submenu has zero getAbsoluteTop() getAbsoluteLeft()

谁都会走 提交于 2020-01-25 18:38:36

问题


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?

Thanks!


回答1:


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.



来源:https://stackoverflow.com/questions/27644719/gwt-menuitem-in-a-submenu-has-zero-getabsolutetop-getabsoluteleft

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!