Thread Rating:
  • 314 Vote(s) - 2.82 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Viewのサイズを自動調整する方法
07-12-2013, 12:43 PM,
#1
Viewのサイズを自動調整する方法
View を表示する際に、画面の大きさを、View の中に格納するグラフィックに合わせて表示したいです。

子供として格納するグラフィックのwidth と height を、View のインスタンスにセットすればよいとは思うのですが、
グラフィックのサイズがエラスティック(elastic)で指定されていると面倒です。

自身の中のグラフィックのサイズに合わせてViewの大きさを調整したいです。
よい方法はありますでしょうか。
07-12-2013, 12:56 PM,
#2
RE: Viewのサイズを自動調整する方法
View.set-size-from-child を利用することでうまく大きさを調整することができました。


Code:
{def fr1:Frame =
    {Frame
        background = "orange",
        width = {make-elastic preferred-size = 5in},
        height = {make-elastic preferred-size = 2in}
    }
}
{def fr2:Frame =
    {Frame
        background = "pink",
        width = {make-elastic preferred-size = 5in},
        height = {make-elastic preferred-size = 2in}
    }
}
{def fr3:Frame =
    {Frame
        background = "aqua",
        width = {make-elastic preferred-size = 5in},
        height = {make-elastic preferred-size = 2in}
    }
}
{def vb = {VBox fr1, fr3}}
{def v =  {View vb}}
{do  {v.show}}
{CommandButton
    label = "View のグラフィックを変更",
    {on Action do
        {vb.add index = 1, fr2}
    }
}
{CommandButton
    label = "View のサイズを調整",
    {on Action do
        {v.set-size-from-child}
    }
}


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('940')