Thread Rating:
  • 258 Vote(s) - 2.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ScrollBox間のスクロール連動
05-09-2017, 01:20 PM,
#1
ScrollBox間のスクロール連動
複数のScrollBoxでスクロール動作を連動したいと思っています。
スクロール時のEventを拾ってテストコードの動作までは確認できたのですが、
スクロールバーをドラッグしている間の連動が実現できておりません。
何か良い方法があればご教示願います。

Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "shift-jis"}

{def vb1 = {VBox}}
{def sb1 = {ScrollBox width = 100px, height = 100px, vb1}}
{def vb2 = {VBox}}
{def sb2 = {ScrollBox width = 100px, height = 100px, vb2}}

{def make-ev1 =
    {proc {arg-sb:ScrollBox}:EventHandler
        {return
            {on PointerScroll at sb:ScrollBox do
                {after 0s do
                    {arg-sb.scroll-to x = sb.horizontal-position, y = sb.vertical-position}
                }
            }
        }
    }
}

{def make-ev2 =
    {proc {arg-sb:ScrollBox}:EventHandler
        {return
            {on pee:PointerEnvelopeEvent at sb:ScrollBox do
                {if pee.contents isa PointerMotion then
                    {after 0s do
                        {arg-sb.scroll-to x = sb.horizontal-position, y = sb.vertical-position}
                    }
                }
            }
        }
    }
}

{sb1.add-event-handler {make-ev1 sb2}}
{sb1.add-event-handler {make-ev2 sb2}}
{sb2.add-event-handler {make-ev1 sb1}}
{sb2.add-event-handler {make-ev2 sb1}}

{for i:int = 1 to 20 do
    {vb1.add {Label i  & "行目"}}
    {vb2.add {Label i  & "行目"}}
}

{View
    {HBox
        sb1,
        sb2
    },
    visibility = "normal",
    {on WindowClose do
        {exit}
    }
}


Messages In This Thread
ScrollBox間のスクロール連動 - by Yudai-s - 05-09-2017, 01:20 PM
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1453')