DetailsView

Regular state

Expanded state

A container which has has two states - either only displaying the content of its "summary" property, or displaying both the summary and child views

Create from source

func NewDetailsView(session Session, params Params) DetailsView

Create new details view object and returns its interface

Create from resource

DetailsView {
    id = detailsView,
    content = TextView {
        id = textView,
        text = "Text",
    },
}

Interface description

Inherit methods, properties and events from ViewsContainer

Properties

"expanded"

Controls the content expanded state of the details view. Default value is false

Constant: Expanded

Types: bool, int, string

Values

bool int string Description
true 1 "true", "yes", "on", "1" Content is visible
false 0 "false", "no", "off", "0" Content is collapsed(hidden)

"not-translate"

Controls whether the label set for the details view require translation. This is an inherited property, i.e. if it is not defined, then the value of the parent view is used. Default value is false

Constant: NotTranslate

Types: bool, int, string

Values

bool int string Description
true 1 "true", "yes", "on", "1" No need to lookup for label text translation in resources
false 0 "false", "no", "off", "0" Lookup for label text translation

"summary"

The content of this property is used as the label for the disclosure widget

Constant: Summary

Types: string, View

string - Summary as a text View - Summary as a view, in this case it can be quite complex if needed

Examples

DetailsView {
    summary = "Example",
    content = "a += b",
}
DetailsView {
    summary = TextView {
        text = Example,
        text-color = gray,
    },
    content = TextView {
        text = "a += b",
        semantics = "code",
    },
}
details := rui.NewDetailsView(session, rui.Params{
    rui.Summary: "Example",
    rui.Content: "a += b",
})
details := rui.NewDetailsView(session, rui.Params{
    rui.Summary: rui.NewTextView(session, rui.Params{
        rui.Text:      "Example",
        rui.TextColor: rui.Gray,
    }),
    rui.Content: rui.NewTextView(session, rui.Params{
        rui.Text:      "a += b",
        rui.Semantics: rui.CodeSemantics,
    }),
})
func DetailsViewByID(rootView View, id string) DetailsView

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

func GetDetailsSummary(view View, subviewID ...string) View

Returns a value of the "summary" property of DetailsView. If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned.

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

Returns a value of the "expanded" property of DetailsView. If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned.

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

Returns the "not-translate" 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