API version 4
- ‐
RW
integer
childLayout¶
子オブジェクトの配置方法を指定します。
初期値はCHILD_STDです。
関連項目
Placement クラス
定数一覧
------------------------------------------------------------
定数値 |
説明 |
---|---|
CHILD_STD |
0:子オブジェクトに設定された位置やサイズに従って配置します。 |
CHILD_HORIZONTAL |
1:水平に並べて配置します。 |
CHILD_VERTICAL |
2:垂直に並べて配置します。 |
CHILD_GRID |
3:グリッド状に並べて配置します。 placement.left で横方向の配置位置、placement.top で縦方向の配置位置を指定します。 placement.right も指定した場合は横方向に複数のセル領域を占有し、placement.bottom も指定した場合は縦方向に複数のセル領域を占有します。 placement.top 不指定時は、順に上から配置されていきます。(通常は、CHILD_GRIDROW とセットで使います。) |
CHILD_GRIDROW |
4:CHILD_GRIDを指定したオブジェクトの子オブジェクトとして1行分の内容を格納します。 子を左から順に配置されていきます。 placement.left指定時は、その分セルを飛ばします。placement.right を指定した場合は横方向に複数のセルを占有します。 |
CHILD_STACK |
6:全ての子をフルサイズに配置し、どれか一つだけ表示させます。 |
CHILD_FLOW |
7:子オブジェクトを親オブジェクト内に敷き詰めるように配置します。子オブジェクトは、先に配置した子オブジェクトの右に十分な空間があれば右に配置し、無ければその下に左に詰めて配置します。 |
使用例
CRSダウンロード
Form formLayoutContainer {
width = 640; height = 480;
Label labelStd_1 { x = 10; y = 10; width = 305; height = 15; title="CHILD_STD"; }
Label labelStd_2 { x = 325; y = 10; width = 305; height = 15; title="CHILD_STD"; }
Label labelHorzontal { x = 10; y = 165; width = 305; height = 15; title="CHILD_HORIZONTAL"; }
Label labelVertical { x = 325; y = 165; width = 305; height = 15; title="CHILD_VERTICAL"; }
Label labelGrid { x = 10; y = 320; width = 305; height = 15; title="CHILD_GRID"; }
Label labelGridRow { x = 325; y = 320; width = 305; height = 15; title="CHILD_GRIDROW"; }
Form FormStd_1 { x = 10; y = 25; width = 305; height = 130;
childLayout=CHILD_STD;
var p0 = new Placement { width="60%"; height="20px"; }
Button button0 { title = "left"; placement = p0; var p = placement; p.top = 10; p.left = 20; placement = p;}
Button button1 { title = "right"; placement = p0; var p = placement; p.top = 40; p.right = 20; placement = p;}
Button button2 { title = "center"; placement = p0; var p = placement; p.top = 70; p.horizontalCenter = 0; placement = p;}
Button button3 { title = "leftright"; placement = p0; var p = placement; p.top = 100; p.left = 20; p.right = 20; placement = p;}
}
Form FormStd_2 { x = 325; y = 25; width = 305; height = 130;
childLayout=CHILD_STD;
var p0 = new Placement { width="60px"; height="60%"; }
Button button0 { title = "top"; placement = p0; var p = placement; p.left = 10; p.top = 10; placement = p;}
Button button1 { title = "bottom"; placement = p0; var p = placement; p.left = 80; p.bottom = 10; placement = p;}
Button button2 { title = "center"; placement = p0; var p = placement; p.left = 150; p.verticalCenter = 0; placement = p;}
Button button3 { title = "topbottom"; placement = p0; var p = placement; p.left = 220; p.top = 10; p.bottom = 10; placement = p;}
}
Form FormHorzontal { x = 10; y = 180; width = 305; height = 130;
childLayout=CHILD_HORIZONTAL;
var p0 = new Placement { width="40px"; height="60%"; } #height: 130px×60%=78px
horizontalSpacing = 10;
verticalAlign = ALIGN_MIDDLE; #上下中央に配置
horizontalAlign = ALIGN_RIGHT; #右詰め
padding = new Margin { right = 10; } #右端に10px空ける
Button button0 { title = "button0"; placement = p0; }
Button button1 { title = "button1"; placement = p0; }
Button button2 { title = "button2"; placement = p0; }
Button button3 { title = "minHeight"; placement = p0; var p = placement; p.minHeight=100; placement = p;} #minHeightの方が78pxより大きいので、height=100px割り当て
Button button4 { title = "maxHeight"; placement = p0; var p = placement; p.maxHeight=50; placement = p;} #maxHeightの方が78pxより小さいので、height=50px割り当て
}
Form FormVertical { x = 325; y = 180; width = 305; height = 130;
childLayout=CHILD_VERTICAL;
var p0 = new Placement { width="60%"; height="15px"; } #width: 305px×60%=183px
verticalSpacing = 5;
padding = new Margin { top = 10; }
Button button0 { title = "button0"; placement = p0; }
Button button1 { title = "button1"; placement = p0; }
Button button2 { title = "button2"; placement = p0; }
Button button3 { title = "minWidth"; placement = p0; var p = placement; p.minWidth=200; placement = p;} # minWidthの方が183pxより大きいので、width=200px割り当て
Button button4 { title = "maxWidth"; placement = p0; var p = placement; p.maxWidth=150; placement = p;} # maxWidthの方が183pxより小さいので、width=150px割り当て
}
Form FormGrid { x = 10; y = 335; width = 305; height = 130;
childLayout=CHILD_GRID;
var p0 = new Placement { width="60px"; height="60px";}
Button button0_0 { title = "button0_0"; placement = p0; var p = placement; p.top = 0; p.left = 0; placement = p;}
Button button0_1 { title = "button01_1";placement = p0; var p = placement; p.top = 0; p.left = 1; p.bottom=1; p.height = null; placement = p;}
Button button0_2 { title = "button0_2"; placement = p0; var p = placement; p.top = 0; p.left = 2; placement = p;}
Button button0_3 { title = "button0_3"; placement = p0; var p = placement; p.top = 0; p.left = 3; placement = p;}
Button button0_4 { title = "button0_4"; placement = p0; var p = placement; p.top = 0; p.left = 4; placement = p;}
p0 = new Placement { height="60px"; } #width不指定なので、1行目の幅指定に合わされる
Button button1_0 { title = "button1_0"; placement = p0; var p = placement; p.top = 1; p.left = 0; placement = p;}
# top = 1; left = 1 には割り当てなし(上行のセルが占有)
Button button1_2 { title = "button1_2"; placement = p0; var p = placement; p.top = 1; p.left = 2; placement = p;}
#2セル分
Button button1_3 { title = "button1_34";placement = p0; var p = placement; p.top = 1; p.left = 3; p.right = 4; placement = p; }
}
Form FormGridRow { x = 325; y = 335; width = 305; height = 130;
childLayout=CHILD_GRID;
var p0 = new Placement { width="60px"; height="60px";}
#GridRowを使う場合は、セルを上下に複数行を割り当てることはできない。
Form formGridRow1 { #top = 0に自動割り当て
childLayout=CHILD_GRIDROW;
border=BORDER_NONE;
Button button0_0 { title = "button0_0"; placement = p0; } #left = 0に自動割り当て
Button button0_1 { title = "button0_1"; placement = p0; } #left = 1に自動割り当て
Button button0_2 { title = "button0_2"; placement = p0; } #left = 2に自動割り当て
Button button0_3 { title = "button0_3"; placement = p0; } #left = 3に自動割り当て
Button button0_4 { title = "button0_4"; placement = p0; } #left = 4に自動割り当て
}
p0 = new Placement { height="60px"; } #width不指定なので、1行目の幅指定に合わされる
Form formGridRow2 { #top = 1に自動割り当て
childLayout=CHILD_GRIDROW;
border=BORDER_NONE;
Button button1_0 { title = "button1_0"; placement = p0; } #left = 0に自動割り当て
#相対指定 left=1のため、絶対座標でleft=2に割り当て
Button button1_2 { title = "button1_2"; placement = p0; var p = placement; p.left = 1; placement = p; }
#left = 3に自動割り当て
#相対指定 right=1のため、絶対座標でright=4に割り当て
#left = 3~4の2セル分占有
Button button1_3 { title = "button1_34"; placement = p0; var p = placement; p.right = 1; placement = p; }
}
}
}