SmartGwt在添加成员后获得VLayout高度 [英] SmartGwt get VLayout height after add members

查看:180
本文介绍了SmartGwt在添加成员后获得VLayout高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加一个成员后,遇到 VLayout 高度问题

  VLayot layout = new VLayout(); 

主持人我有代码

  display.getAnswerPanel()removeMembers(display.getAnswerPanel()getMembers()。)。 

清除所有成员,并添加另一个(我有按钮,当我舔他们时,它会清除所有 VLayout 并添加新成员)

  layout.addMember(new Button (例)); 

我需要获得 offsetHeight code> VLayout 在开始和每次我点击按钮,我的问题是,当我第一次加载页面时,我的offsetHeigh是1px,每次我点击按钮时都是OK它显示出正确的价值。有人能帮我吗?



我试着使用这段代码

  scheduler.get() .scheduleDeferred(new Scheduler.ScheduledCommand(){
layout.getOffsetHeight();
}

但情况相同,第一次我没有正确的值。 解决方案

Scheduler#scheduleDeferred ()在GWT循环结束时执行,所以还没有时间让布局更新。我想除了使用传统的定时器破解之外,没有什么可以做的了(如果有任何读者有疑问,是的,我的意思是使用setTimeout()或Scheduler.get()。scheduleWithFixedDelay(cmd,200))。


I have problem a with getting VLayout height after I add a member to it

VLayot layout = new VLayout();

in presenter I have code

display.getAnswerPanel().removeMembers(display.getAnswerPanel().getMembers());

which clear all members, and I add another (I have buttons, when I clik them, it clears all VLayout and adds new members)

layout.addMember(new Button("Example"));

I need to get offsetHeight of this VLayout on start and everytime I click the button, my problem is that in first time when I load the page, my `offsetHeigh is 1px, each next time when I click button is ok, it shows me the correct value. Can someone help me?

I tried to use this code

scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
    layout.getOffsetHeight();
}

but the situation is the same, First time I don't have the correct value.

解决方案

Scheduler#scheduleDeferred() executes at the end of the GWT loop, so there's still no time for the layout to update either. I guess there's not much you can do besides using the traditional timer hack (in case any reader is in doubt, yes, I meant using setTimeout() or Scheduler.get().scheduleWithFixedDelay(cmd, 200) ).

这篇关于SmartGwt在添加成员后获得VLayout高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆