gridbag拘束プロパティ
gridbag拘束プロパティの説明.
呼び出し手順
constraints = createConstraints("gridbag") constraints = createConstraints("gridbag", grid) constraints = createConstraints("gridbag", grid, weight) constraints = createConstraints("gridbag", grid, weight, fill) constraints = createConstraints("gridbag", grid, weight, fill, anchor) constraints = createConstraints("gridbag", grid, weight, fill, anchor, padding) constraints = createConstraints("gridbag", grid, weight, fill, anchor, padding, preferredsize)
引数
- grid
[pos_x, pos_y, width, height]
1行4列double行列, デフォルトは [0, 0, 0, 0].pos_x
およびpos_x
は 仮想グリッドの要素の座標です.width
およびheight
は 仮想グリッドの要素の幅と高さです.- weight
[weight_x, weight_y]
1行2列double行列, デフォルトは [0, 0].どちらかの軸のリサイズに適用される重み.
より大きな値は,リサイズ時に要素がより空白を得ることを 意味します.
- fill
文字列
{"none"} | "horizontal" | "vertical" | "both"
どちらかの方向(または両方)のリサイズする際に 利用可能な空間を埋める方法を示します.
- anchor
文字列
{"center"} | "upper" | "upper_right" | "right" | "lower_right" | "lower" | "lower_left" | "left" | "upper_left"
ネストした領域より小さい時,要素を固定する場所を指定.
- padding
[pad_x, pad_y]
1行2列double行列, デフォルトは [0 0]この要素と周辺の要素の間にパディング.
- preferred_size
[p_size_x, p_size_y]
1行2列double行列, デフォルトは[-1 -1]拘束されていない時の好ましい大きさ(単位:ピクセル)であり, ネストしたフレームをリサイズする際,大きさを変更する ことを回避する際に使用されます.
- constraints
作成された拘束.
例
//Creates the figure with a gridbag layout f = figure( ... "dockable" , "off",... "infobar_visible" , "off",... "toolbar" , "none",... "menubar_visible" , "off",... "menubar" , "none",... "default_axes" , "off",... "layout" , "gridbag",... "visible" , "on"); redf_grid = [1, 1, 2, 1]; //Red frame is placed at 1x1 and is a 2x1 rectangle greenf_grid = [3, 1, 1, 2]; //Green frame is at 3x1 and is a 1x2 rectangle bluef_grid = [1, 2, 1, 1]; //Blue frame is at 2x1 and is a 1x1 rectangle yelf_grid = [1, 3, 2, 2]; //Yellow frame is at 1x3 and is a 2x2 rectangle magf_grid = [3, 4, 1, 1]; //Magenta frame is at 3x4 and is a 1x1 rectangle cyanf_grid = [2, 2, 1, 1]; //Cyan is at 2x2 and is a 1x1 rectangle whitf_grid = [3, 3, 1, 1]; //White is at 3x3 and is a 1x1 rectangle c = createConstraints("gridbag",[1, 1, 1, 1], [1, 1], "both", "center", [0, 0], [50, 50]); c.grid = redf_grid; u_grid1 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [1 0 0] , ... "constraints" , c); sleep(500); c.grid = greenf_grid; c.weight = [0.1,1]; //Last column will fill horizontal space 10 times less thanother columns u_grid2 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [0 1 0] , ... "constraints" , c); sleep(500); c.grid = bluef_grid; c.weight = [1,1]; c.fill = "none" //This will force the blue square to be at the preferred size u_grid3 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [0 0 1] , ... "constraints" , c); sleep(500); c.grid = cyanf_grid; c.fill = "vertical" // this will fill the empty space with cyan vertically c.anchor = "right" //this will position the cyan stripe on the right c.padding = [100,0] //this will extend the cyan stripe horizontally up to 100 pixel if space is available u_grid1 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [0 1 1] , ... "constraints" , c); sleep(500); c.grid = yelf_grid; c.fill = "both"; c.anchor ="center"; c.padding = [0,0]; u_grid4 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [1 1 0] , ... "constraints" , c); sleep(500); c.grid = whitf_grid; c.weight = [0.1,1] u_grid1 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [1 1 1] , ... "constraints" , c); sleep(500); c.grid = magf_grid; c.weight = [0.1,1] u_grid5 = uicontrol(f , ... "style" , "frame" , ... "backgroundcolor" , [1 0 1] , ... "constraints" , c);
説明
この関数は,
uicontrols constraints
属性を設定する
gridbag拘束を作成します.
参照
- layout — uicontrolおよびfigure用の異なる配置および拘束の説明.
- uicontrol — グラフィックユーザーインターフェイスオブジェクトを作成
- uicontrol_properties — uicontrolプロパティの説明.
履歴
バージョン | 記述 |
5.5.0 | 関数 createBorder が導入されました. |
Report an issue | ||
<< grid配置オプションプロパティ | Layouts | gridbag配置オプションプロパティ >> |