需要GWT SplitLayoutPanel具有最大尺寸,拖动非常麻烦 [英] Need GWT SplitLayoutPanel to have max size, dragging is very jumpy

查看:86
本文介绍了需要GWT SplitLayoutPanel具有最大尺寸,拖动非常麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种很好的方法来为SplitLayoutPanel的子项设置最大大小?现在我重写它的onResize方法并调用JSNI函数来设置中间面板的div的div div,右侧面板的div和分离器面板的div的右侧或左侧样式属性(如果右侧/东侧面板宽度超过400px) 。

我注意到分离器和右侧面板的尺寸甚至没有跟随鼠标光标,并在大约4/5和2/5之间大幅度摆动,因为它们应该是基于鼠标指针当前的位置。



我在eclipse中调试并尝试在没有eclipse的情况下运行它,它也是一样的。我也打电话给super.onResize()。

解决方案

您可以通过添加中间的ResizeLayoutPanels来修复生涩/跳动的情况。

MyComposite.ui.xml:


$ b

 <!DOCTYPE ui:UiBinder SYSTEMhttp ://dl.google.com/gwt/DTD/xhtml.ent> 
< ui:UiBinder xmlns:ui =urn:ui:com.google.gwt.uibinder
xmlns:g =urn:import:com.google.gwt.user.client.ui
xmlns:my =urn:import:my.custom.package.client>

< g:west size =250>
< g:ResizeLayoutPanel ui:field =leftMenuOuterPanel>
< my:MenuWidget ui:field =menuWidget/>
< / g:ResizeLayoutPanel>
< / g:west>
< g:ResizeLayoutPanel ui:field =centerOuterPanel>
< my:AwesomeWidget ui:field =centerWidget/>
< / g:ResizeLayoutPanel>
< / g:center>
< / g:SplitLayoutPanel>

< / ui:UiBinder>

感谢OlivierH 答案


Is there a good way to set the max size for a child of a SplitLayoutPanel? Right now I override its onResize method and call a JSNI function to set the right or width style properties of the parent div of the center panel's div, the right panel's div and the splitter panel's div, if the right/east panel is over 400px wide.

I noticed the splitter and the right panel's size don't even follow the mouse cursor and oscillate wildly between about 4/5 and 2/5 as wide as they should be based on where the mouse pointer currently is.

I have debug in eclipse and tried running it without eclipse and it's the same. I am calling super.onResize(), as well.

解决方案

You can fix the jerky/jumpy movements by adding intermediate ResizeLayoutPanels.

MyComposite.ui.xml :

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui" 
    xmlns:my="urn:import:my.custom.package.client">

<g:SplitLayoutPanel ui:field="splitLayoutPanel">
    <g:west size="250">
    <g:ResizeLayoutPanel ui:field="leftMenuOuterPanel">
            <my:MenuWidget ui:field="menuWidget" />
        </g:ResizeLayoutPanel>
    </g:west>
    <g:center>
        <g:ResizeLayoutPanel ui:field="centerOuterPanel">
            <my:AwesomeWidget ui:field="centerWidget" />
        </g:ResizeLayoutPanel>
    </g:center>
</g:SplitLayoutPanel>

</ui:UiBinder>

thanks to OlivierH answer

这篇关于需要GWT SplitLayoutPanel具有最大尺寸,拖动非常麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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