.. default-domain:: js .. highlight:: js .. module:: UI :no-index: Layout ====== .. class:: Layout Arranges the elements of a panel automatically, so that they do not have to be positioned one by one. See :meth:`UI.Panel.addHorizontalLayout`, :meth:`UI.Panel.addVerticalLayout` and :meth:`UI.Panel.addGridLayout`. .. method:: getSpacing() setSpacing(value) The gap left between the elements, in pixels. A grid layout uses it in both directions. :Property: Can be read or written :rtype: ``number`` .. method:: getPadding() setPadding(value) The gap left inside the edges of the panel. :Property: Can be read or written :rtype: :class:`UI.Padding` .. method:: getChildAlignment() setChildAlignment(value) Where the elements are placed within the space the layout has to fill. :Property: Can be read or written :rtype: :class:`UI.TextAnchor` .. method:: getCellSize() setCellSize(value) The size of each cell of a grid layout, in pixels. :Property: Can be read or written :rtype: ``[number, number]`` .. note:: Only applies to a grid layout. Throws an exception for the other layouts, whose elements are sized individually using their layout elements. .. method:: getConstraint() setConstraint(value) What fixes the shape of a grid layout. :Property: Can be read or written :rtype: :class:`UI.GridConstraint` .. note:: Only applies to a grid layout. Throws an exception for the other layouts. .. method:: getConstraintCount() setConstraintCount(value) The number of columns or rows that :meth:`UI.Layout.getConstraint` fixes, ignored when the constraint is :attr:`UI.GridConstraint.flexible`. :Property: Can be read or written :rtype: ``number`` .. note:: Only applies to a grid layout. Throws an exception for the other layouts. .. class:: Padding(fields) The gap left inside each edge of a layout, in whole pixels. .. note:: See :meth:`UI.Layout.getPadding`. .. attribute:: left The gap inside the left edge. :Type: ``number`` .. attribute:: right The gap inside the right edge. :Type: ``number`` .. attribute:: top The gap inside the top edge. :Type: ``number`` .. attribute:: bottom The gap inside the bottom edge. :Type: ``number`` .. class:: GridConstraint What fixes the shape of a grid layout. .. attribute:: flexible Fit as many columns and rows as the size of the panel allows. .. attribute:: fixedColumnCount Use a fixed number of columns, and as many rows as are needed. .. attribute:: fixedRowCount Use a fixed number of rows, and as many columns as are needed.