ColumnLayout

A container that arranges its child views vertically and horizontally. The alignment of these views depends on the "text-direction" property

Create from source

func NewColumnLayout(session Session, params Params) ColumnLayout

Create new column layout object and returns its interface

Create from resource

ColumnLayout {
    id = columnLayout,
    width = 100%,
    height = 100%,
    content = [],
}

Interface description

Inherit methods, properties and events from ViewsContainer

Properties

"avoid-break"

Controls how region breaks should behave inside a generated box

Constant: AvoidBreak

Types: bool, int, string

Values

bool int string Description
true 1 "true", "yes", "on", "1" Avoid any break from being inserted within the principal box
false 0 "false", "no", "off", "0" Allow, but does not force, any break to be inserted within the principal box

"column-count"

Specifies number of columns into which the content is break. Values less than zero are not valid. If this property value is 0 then the number of columns is calculated based on the "column-width" property

Constant: ColumnCount

Types: int, string

Values

int string Description
0 "0" Use "column-width" to control how many columns will be created
>= 0 >= "0" Тhe number of columns into which the content is divided

"column-fill"

Controls how a ColumnLayout's content is balanced when broken into columns. Default value is "balance"

Constant: ColumnFill

Types: int, string

Values

int string Description
0(ColumnFillBalance) "balance" Content is equally divided between columns
1(ColumnFillAuto) "auto" Columns are filled sequentially. Content takes up only the room it needs, possibly resulting in some columns remaining empty

"column-gap"

Set the size of the gap (gutter) between columns

Constant: ColumnGap

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

ColumnLayout {
    width = 5em,
    height = 5em,
    column-count = 2,
    column-gap = 1em,
    content = [
        TextView {
            text = "Some text",
        },
        TextView {
            text = "Some text",
        },
    ],
}
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:       rui.Em(5),
    rui.Height:      rui.Em(5),
    rui.ColumnCount: 2,
    rui.ColumnGap:   rui.Em(1),
    rui.Content:     []string{
        "Some text",
        "Some text",
    },
})

"column-separator"

Specifies the line drawn between columns in a multi-column layout

Constant: ColumnSeparator

Types: ColumnSeparatorProperty, ViewBorder

Internal type is ColumnSeparatorProperty, other types converted to it during assignment

See ColumnSeparatorProperty and ViewBorder description for more details

Examples

ColumnLayout {
    width = 5em,
    height = 5em,
    column-count = 2,
    column-gap = 1em,
    column-separator = _{ style = solid, width = 1px, color = #FF000000 },
    content = [
        "Some text",
        "Some text",
    ],
}
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:       rui.Em(5),
    rui.Height:      rui.Em(5),
    rui.ColumnCount: 2,
    rui.ColumnGap:   rui.Em(1),
    rui.ColumnSeparator: rui.NewColumnSeparator(rui.Params{
        rui.Style:    rui.SolidLine,
        rui.ColorTag: "black",
        rui.Width:    rui.Px(1),
    }),
    rui.Content: []string{
        "Some text",
        "Some text",
    },
})
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:       rui.Em(5),
    rui.Height:      rui.Em(5),
    rui.ColumnCount: 2,
    rui.ColumnGap:   rui.Em(1),
    rui.ColumnSeparator: rui.ViewBorder{
        Style: rui.SolidLine,
        Color: rui.Black,
        Width: rui.Px(1),
    },
    rui.Content: []string{
        "Some text",
        "Some text",
    },
})

"column-separator-color"

Set the color of the line drawn between columns in a multi-column layout

Constant: ColumnSeparatorColor

Types: Color, string

Internal type is Color, other types converted to it during assignment

See Color description for more details

Examples

ColumnLayout {
    width = 5em,
    height = 5em,
    column-count = 2,
    column-separator-color = #FFBEBEBE,
    column-separator-style = solid,
    column-separator-width = 1px,
    content = [
        "Some text",
        "Some text",
    ],
}
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:                rui.Em(5),
    rui.Height:               rui.Em(5),
    rui.ColumnCount:          2,
    rui.ColumnSeparatorColor: rui.Black,
    rui.ColumnSeparatorStyle: "solid",
    rui.ColumnSeparatorWidth: rui.Px(1),
    rui.Content: []string{
        "Some text",
        "Some text",
    },
})
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:                rui.Em(5),
    rui.Height:               rui.Em(5),
    rui.ColumnCount:          2,
    rui.ColumnSeparatorColor: "#FFBEBEBE",
    rui.ColumnSeparatorStyle: "solid",
    rui.ColumnSeparatorWidth: rui.Px(1),
    rui.Content: []string{
        "Some text",
        "Some text",
    },
})

"column-separator-style"

Controls the style of the line drawn between columns in a multi-column layout

Constant: ColumnSeparatorStyle

Types: int, string

Values

int string Description
0(NoneLine) "none" The separator will not be drawn
1(SolidLine) "solid" Solid line as a separator
2(DashedLine) "dashed" Dashed line as a separator
3(DottedLine) "dotted" Dotted line as a separator
4(DoubleLine) "double" Double line as a separator

"column-separator-width"

Set the width of the line drawn between columns in a multi-column layout

Constant: ColumnSeparatorWidth

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

ColumnLayout {
    width = 5em,
    height = 5em,
    column-count = 2,
    column-separator-color = #FFBEBEBE,
    column-separator-style = solid,
    column-separator-width = 1px,
    content = [
        "Some text",
        "Some text",
    ],
}
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:                rui.Em(5),
    rui.Height:               rui.Em(5),
    rui.ColumnCount:          2,
    rui.ColumnSeparatorColor: rui.Black,
    rui.ColumnSeparatorStyle: "solid",
    rui.ColumnSeparatorWidth: rui.Px(1),
    rui.Content: []string{
        "Some text",
        "Some text",
    },
})

"column-span-all"

Property used in views placed inside the column layout container. Makes it possible for a view to span across all columns. Default value is false

Constant: ColumnSpanAll

Types: bool, int, string

Values

bool int string Description
true 1 "true", "yes", "on", "1" View will span across all columns
false 0 "false", "no", "off", "0" View will be a part of a column

"column-width"

Specifies the width of each column

Constant: ColumnWidth

Types: SizeUnit, SizeFunc, string, float, int

Internal type is SizeUnit, other types converted to it during assignment

See SizeUnit description for more details

Examples

ColumnLayout {
    width = 100%,
    height = 100%,
    column-width = 10em,
    content = [
        "Some text",
        "Some text",
    ],
}
layout := rui.NewColumnLayout(session, rui.Params{
    rui.Width:       rui.Percent(100),
    rui.Height:      rui.Percent(100),
    rui.ColumnWidth: rui.Em(10),
    rui.Content: []string{
        "Some text",
        "Some text",
    },
})

"text-direction"

Sets the direction of text, table columns, and horizontal overflow. This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. Default value is "system"

Constant: TextDirection

Types: int, string

Values

int string Description
0(SystemTextDirection) "system" Use the system text direction
1(LeftToRightDirection) "left-to-right" For languages written from left to right (like English and most other languages)
2(RightToLeftDirection) "right-to-left" For languages written from right to left (like Hebrew or Arabic)
func ColumnLayoutByID(rootView View, id string) ColumnLayout

Return a ColumnLayout with id equal to the argument of the function or nil if there is no such View or View is not ColumnLayout

func GetAvoidBreak(view View, subviewID ...string) bool

Returns "true" if avoids any break from being inserted within the principal box, and "false" if allows, but does not force, any break to be inserted within the principal box. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnCount(view View, subviewID ...string) int

Returns int value which specifies number of columns into which the content of ColumnLayout is break. If the return value is 0 then the number of columns is calculated based on the "column-width" property. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnFill(view View, subviewID ...string) int

Returns a "column-fill" property value of the subview. Returns one of next values: ColumnFillBalance (0) and ColumnFillAuto (1) If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned.

func GetColumnGap(view View, subviewID ...string) SizeUnit

Returns SizeUnit value which specifies the size of the gap (gutter) between columns of ColumnLayout. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnSeparator(view View, subviewID ...string) ViewBorder

Returns ViewBorder struct which specifies the line drawn between columns in a multi-column ColumnLayout. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnSeparatorColor(view View, subviewID ...string) Color

Returns Color value which specifies the color of the line drawn between columns in a multi-column layout. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnSeparatorStyle(view View, subviewID ...string) int

Returns int value which specifies the style of the line drawn between columns in a multi-column layout. Possible values are: NoneLine (0), SolidLine (1), DashedLine (2), DottedLine (3) and DoubleLine (4). If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnSeparatorWidth(view View, subviewID ...string) SizeUnit

Returns SizeUnit value which specifies the width of the line drawn between columns in a multi-column layout. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func GetColumnWidth(view View, subviewID ...string) SizeUnit

Returns SizeUnit value which specifies the width of each column of ColumnLayout. If the second argument (subviewID) is not specified or is an empty string then a top position of the first argument (view) is returned

func IsColumnSpanAll(view View, subviewID ...string) bool

Returns a "column-span-all" property value of the subview. If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned.