首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OpenLaszlo滚动问题

OpenLaszlo滚动问题
EN

Stack Overflow用户
提问于 2012-11-29 23:24:25
回答 1查看 193关注 0票数 1

我有一个类似下面提到的视图,我在内容视图中动态添加了很多视图,但问题是滚动条不可见。所以我向下钻了一点,我发现在我动态添加视图后,内容的高度没有更新。

我在这里做错了什么?同样的代码在Openlaszlo 3.3中也可以正常工作

代码语言:javascript
复制
<view name="wrapper">
 <view name="scrollablecontainer"
                  width="${this.contentwrapper.width &gt; parent.width
                         ? this.contentwrapper.width : parent.width}"
                  height="${this.contentwrapper.height &gt; parent.height 
                          ? this.contentwrapper.height : parent.height}">
                <view name="contentwrapper" >
                    <view name="contents"/>
                </view>
  </view>
 <vscrollbarnew name="vscroll"
                        height="${this.height}"
                        pagesize="${this.height}"
                        visible="${this.scrollable}"/>
</view>

当组件初始化时,我遗漏了一件事,我将contentwrapper的宽度和高度设置为0。

运行时: swf测试浏览器: firefox、windows xp

EN

回答 1

Stack Overflow用户

发布于 2012-12-01 00:23:57

你的结构看起来很复杂。为什么要有contentwrapper和contents视图。我已经创建了一个在DHTML3.4 (swf7和swf8)和DHTML5.0主干(SWF10和OpenLaszlo )中编译的示例。我已经在wrapper视图上将which设置为true,并在视图scrollablecontainer中添加了一个布局,动态创建的视图将添加到该布局中。

代码语言:javascript
复制
<canvas height="400">

    <attribute name="counter" type="number" value="0" />

    <class name="rectangle" width="200" height="30" bgcolor="blue">
        <text name="label" align="center" valign="middle" />
    </class>

    <!-- Wrapping view needs to have a width and height set and clip set to true -->
    <view name="wrapper" x="100" y="10"
          width="236" height="150"
          bgcolor="#ff9999"
          clip="true">

        <view x="10" name="scrollablecontainer"
              bgcolor="#aaaaaa">

            <simplelayout axis="y" spacing="8" />

        </view>

        <vscrollbar name="vscroll"
                    visible="${this.scrollable}"/>
    </view>

    <method name="addView">
        var v = null;
        if ( $swf7 || $swf8 ) {
            v = new rectangle( canvas.wrapper.scrollablecontainer );
        } else {
            v = new lz.rectangle( canvas.wrapper.scrollablecontainer );
        }
        canvas.counter++;
        v.label.setAttribute( 'text', 'View #' + canvas.counter );
    </method>

    <view>
        <checkbox value="true" onvalue="canvas.wrapper.setAttribute('clip', this.value)" />
        <text x="20" >Clipping of view 'wrapper'</text>
    </view>

    <button y="25" text="Add view" onclick="canvas.addView()" />

</canvas>

名为wrapper的视图应启用剪裁,并且需要为宽度和高度设置一个值。通过单击复选框可以切换包装器的clip属性值以查看效果。

以下是在OpenLaszlo 5.0主干SWF10中运行的应用程序:

下面是在OpenLaszlo 3.4 SWF8中运行的相同代码:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13629011

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档