弯曲的树被即使使用滚动条后切碎 [英] flex tree gets chopped even after using scroll bar

查看:169
本文介绍了弯曲的树被即使使用滚动条后切碎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用下面的树渲染器类在树中的informtions被砍伤。有没有什么解决方案来解决这个问题。请帮助我。 所述PLTree类如下:

when i use the following tree renderer class the the informtions in the tree gets chopped. Is there any solution to fix this bug. please help me. The PLTree class is as follows:

import flash.events.Event;
    import mx.events.ScrollEvent;
    import mx.controls.Tree;
    import mx.core.ScrollPolicy;
    import mx.core.mx_internal;
    import mx.events.TreeEvent;

    public class PLTree extends Tree
    {
        private var _lastWidth:Number = 0;
        private var _lastHeight:Number = 0;
        public function PLTree() {
            super();
            horizontalScrollPolicy = ScrollPolicy.AUTO;
        }       
       override public function get maxHorizontalScrollPosition():Number
       {
            return mx_internal::_maxHorizontalScrollPosition;
       }     
       override public function set maxHorizontalScrollPosition(value:Number):void
       {
            mx_internal::_maxHorizontalScrollPosition = value;
            dispatchEvent(new Event("maxHorizontalScrollPositionChanged"));      
            scrollAreaChanged = true;
            invalidateDisplayList();
       }      
       override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
       {
            var diffWidth:Number = measureWidthOfItems(0,0) - (unscaledWidth - viewMetrics.left - viewMetrics.right);

            if (diffWidth <= 0) {
                maxHorizontalScrollPosition = 0;
                horizontalScrollPolicy = ScrollPolicy.OFF;
            } else {
                maxHorizontalScrollPosition = diffWidth;
                horizontalScrollPolicy = ScrollPolicy.ON;
            }
            super.updateDisplayList(unscaledWidth, unscaledHeight);
       }
    override protected function scrollHandler(event:Event):void
    {
        if (mx_internal::isOpening)
            return;

        // TextField.scroll bubbles so you might see it here
        if (event is ScrollEvent){

            super.scrollHandler(event);
            invalidateDisplayList();
        }
    }   
}

我附上了它的外观执行时的图像文件。

i am attaching the image file of how it looks when executed.

在使用谷歌冲浪,我发现一个suggesion来修复这个bug是它的正确方法? (

When surfing using google i found a suggesion to fix this bug is it the right way ? (

Issue: Text getting chopped of at end.
Fix: change
maxHorizontalScrollPosition = diffWidth;
to
maxHorizontalScrollPosition = diffWidth + 10;
or what ever correction factor you need. 

请帮我.Thanks很多提前。

Kindly help me .Thanks a lot in advance.

推荐答案

类似于上述程序的滚动处理。使用鼠标滚轮的滚动处理程序来处理该事件,如下所示:

similar to the scroll handler in the above mentioned program. Use a mouse wheel scroll handler to handle that event as follows:

override protected function mouseWheelHandler(eventMouse:MouseEvent):void
     {      if (mx_internal::isOpening)
            return;

        if (eventMouse is MouseEvent){          
            super.mouseWheelHandler(eventMouse);
            invalidateDisplayList();
        }
     }

这篇关于弯曲的树被即使使用滚动条后切碎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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