private void verticalScrollBar_ValueChanged(MyScrollbar scrollbar)
        {
            int offset         = (int)scrollbar.Value;
            int visibleCounter = -1;

            for (int i = 0; i < Items.Count; i++)
            {
                if (Items[i].Visible)
                {
                    visibleCounter++;
                }
                if (visibleCounter == offset)
                {
                    offset = i;
                    break;
                }
            }
            m_visibleRowIndexOffset = offset;
        }
Example #2
0
        public MyGuiControlList(
            Vector2?position        = null,
            Vector2?size            = null,
            Vector4?backgroundColor = null,
            String toolTip          = null,
            MyGuiControlListStyleEnum visualStyle = MyGuiControlListStyleEnum.Default)
            : base(position : position,
                   size : size,
                   backgroundColor :  backgroundColor,
                   toolTip : toolTip)
        {
            Name = "ControlList";

            m_realSize  = size ?? Vector2.One;
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += ValueChanged;

            VisualStyle = visualStyle;
            RecalculateScrollbar();

            Controls.CollectionChanged += OnVisibleControlsChanged;
            Controls.CollectionMembersVisibleChanged += OnVisibleControlsChanged;
        }
 private void scrollbar_ValueChanged(MyScrollbar scrollbar)
 {
     RefreshScrolledControlPosition();
 }
        public MyGuiControlList(
            Vector2? position                     = null,
            Vector2? size                         = null,
            Vector4? backgroundColor              = null,
            String toolTip                        = null,
            MyGuiControlListStyleEnum visualStyle = MyGuiControlListStyleEnum.Default)
            : base( position: position,
                    size: size,
                    backgroundColor:  backgroundColor,
                    toolTip: toolTip)
        {
            Name = "ControlList";

            m_realSize = size ?? Vector2.One;
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += ValueChanged;

            VisualStyle = visualStyle;
            RecalculateScrollbar();

            Controls.CollectionChanged += OnVisibleControlsChanged;
            Controls.CollectionMembersVisibleChanged += OnVisibleControlsChanged;
        }
 private void ValueChanged(MyScrollbar scrollbar)
 {
     CalculateNewPositionsForControls(scrollbar.Value);
 }
 private void scrollbar_ValueChanged(MyScrollbar scrollbar)
 {
     RefreshScrolledControlPosition();
 }
 private void verticalScrollBar_ValueChanged(MyScrollbar scrollbar)
 {
     m_visibleRowIndexOffset = (int)scrollbar.Value;
 }
 private void verticalScrollBar_ValueChanged(MyScrollbar scrollbar)
 {
     m_visibleRowIndexOffset = (int)scrollbar.Value;
 }
Example #9
0
 private void ValueChanged(MyScrollbar scrollbar)
 {
     CalculateNewPositionsForControls(scrollbar.Value);
 }
 private void verticalScrollBar_ValueChanged(MyScrollbar scrollbar)
 {
     int offset = (int)scrollbar.Value;
     int visibleCounter = -1;
     for(int i = 0; i < Items.Count; i++)
     {
         if (Items[i].Visible)
             visibleCounter++;
         if (visibleCounter == offset)
         {
             offset = i;
             break;
         }
     }
     m_visibleRowIndexOffset = offset;
 }