gPositionItemWidth = max_char_width() * 9;
gPositionCluster = '$$$/Dialogs/FieldProps/Position/ClusterName';
gLeft = '$$$/Dialogs/FieldProps/Position/Left';
gBottom = '$$$/Dialogs/FieldProps/Position/Bottom';
gRight = '$$$/Dialogs/FieldProps/Position/Right';
gTop = '$$$/Dialogs/FieldProps/Position/Top';
gHeight = '$$$/Dialogs/FieldProps/Position/Height';
gWidth = '$$$/Dialogs/FieldProps/Position/Width';
gLock = '$$$/Dialogs/FieldProps/Position/Locked';
gStaticWidth = max(
	zstring_width(zstring: '$$$/Dialogs/FieldProps/Position/Left'),
	zstring_width(zstring: '$$$/Dialogs/FieldProps/Position/Right'),
	zstring_width(zstring: '$$$/Dialogs/FieldProps/Position/Top'),
	zstring_width(zstring: '$$$/Dialogs/FieldProps/Position/Bottom'),
	zstring_width(zstring: '$$$/Dialogs/FieldProps/Position/Height'),
	zstring_width(zstring: '$$$/Dialogs/FieldProps/Position/Width'));

gMaxUnits = max( 
	zstring_width(zstring: 'IDS_UNIT_Points'),  
	zstring_width(zstring: 'IDS_UNIT_Picas'),
	zstring_width(zstring: 'IDS_UNIT_Inches'),  
	zstring_width(zstring: 'IDS_UNIT_Millimeters'),  
	zstring_width(zstring: 'IDS_UNIT_Centimeters'));

dialog(name: '$$$/Dialogs/FieldProps')
{
	view(align_children: align_left)
	{
		view(align_children: align_row, alignment: align_left)
		{
			static_text(item_id: 'unil', name: '$$$/Dialogs/FieldProps/Position/Units');						
			popup(item_id: 'unit', width: gMaxUnits);
		}
		cluster(item_id:'pocl', name: gPositionCluster, align_children: align_row)
		{
			view(align_children: align_left)
			{
				view(align_children: align_row)
				{
					view(align_children: align_right, width: gStaticWidth)
					{
						static_text(item_id: 'slef', name: gLeft);
					}
					view(align_children: align_row)
					{
						edit_text(item_id: 'plef', SpinEdit: true, numeric: true, width: gPositionItemWidth);
					}
				}
				view(align_children: align_row)
				{
					view(align_children: align_right, width: gStaticWidth)
					{
						static_text(item_id: 'srig', name: gRight);
					}
					view(align_children: align_row)
					{
						edit_text(item_id: 'prig', SpinEdit: true, numeric: true, width: gPositionItemWidth);
					}
				}
				view(align_children: align_row)
				{
					view(align_children: align_right, width: gStaticWidth)
					{
						static_text(item_id: 'swid', name: gWidth);
					}
					view(align_children: align_row)
					{
						edit_text(item_id: 'widt', SpinEdit: true, numeric: true, width: gPositionItemWidth);
					}
				}
			}
			view(align_children: align_right)
			{
				view(align_children: align_row)
				{
					view(align_children: align_right, width: gStaticWidth)
					{
						static_text(item_id: 'sbot', name: gBottom);
					}
					view(align_children: align_left)
					{
						edit_text(item_id: 'pbot', SpinEdit: true, numeric: true, width: gPositionItemWidth);
					}
				}
				view(align_children: align_row)
				{
					view(align_children: align_right, width: gStaticWidth)
					{
						static_text(item_id: 'stop', name: gTop);
					}
					view(align_children: align_left)
					{
						edit_text(item_id: 'ptop', SpinEdit: true, numeric: true, width: gPositionItemWidth);
					}
				}
				view(align_children: align_row)
				{
					view(align_children: align_right, width: gStaticWidth)
					{
						static_text(item_id: 'shei', name: gHeight);
					}
					view(align_children: align_left)
					{
						edit_text(item_id: 'heig', SpinEdit: true, numeric: true, width: gPositionItemWidth);
					}
				}
			}
		}
		view(align_children: align_row)
		{
			check_box(item_id: 'hwlk', name: gLock);
		}
	}
}
