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) |
"hide-summary-marker"
Allows to hide the summary marker (▶︎)
Constant: HideSummaryMarker
Types: bool
, int
, string
Values
bool | int | string | Description |
---|---|---|---|
true |
1 |
"true", "yes", "on", "1" | The summary marker is hidden |
false |
0 |
"false", "no", "off", "0" | The summary marker is displayed (default value) |
"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,
}),
})
Related global functions
func DetailsViewByID(rootView View, id string, ids ...string) DetailsView
Returns the child DetailsView, path to which is specified using the arguments id, ids. Example: view := DetailsViewByID(rootView, "id1", "id2", "id3")
, view := DetailsViewByID(rootView, "id1/id2/id3")
. These two function calls are equivalent. If a View with this path is not found or View is not DetailsView, the function will return nil.
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 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.
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 IsSummaryMarkerHidden(view View, subviewID ...string) bool
Returns a value of the "hide-summary-marker" property of DetailsView
. If the second argument (subviewID) is not specified or it is "" then a value from the first argument (view) is returned.