API version 4
- ‐
RW
integer
horizontalAlign¶
子オブジェクトの水平方向の位置合わせ方法を指定します。
childLayout=CHILD_HORIZONTAL、CHILD_VERTICALの場合のみ、意味を持ちます。
ALIGN_STDは左寄せになります。
定数値 |
説明 |
---|---|
ALIGN_STD |
0:標準位置 |
ALIGN_LEFT |
1:左寄せ |
ALIGN_CENTER |
2:中央寄せ |
ALIGN_RIGHT |
3:右寄せ |
初期値はALIGN_STDです。
関連項目
childLayout 、 horizontalSpacing 、 verticalAlign プロパティ
使用例
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; }
}
}
}