gpt4 book ai didi

gwt getOffsetWidth 返回零

转载 作者:行者123 更新时间:2023-12-02 09:57:09 24 4
gpt4 key购买 nike

我需要在屏幕上渲染小部件后获取其宽度,因为当我在附加小部件后尝试获取其宽度时,它会返回零。我最早什么时候可以检索到小部件的有效偏移宽度?

提前致谢!

最佳答案

只有在浏览器构建页面内容后才知道框的偏移宽度。使用scheduleDefferred(),即可获取该值。

示例:

final TextBox yourInput = new TextBox();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
int width = yourInput.getOffsetWidth();
/* Do anything with width */
}
});

关于gwt getOffsetWidth 返回零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7747433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com