forked from mbk-lab/rui_orig
Fixed Set(rui.Visibility, ...) bug
This commit is contained in:
parent
aa7d086498
commit
03799c329e
|
@ -66,6 +66,20 @@ ListLayout {
|
|||
TextView { id = controlsDateResult, margin-left = 12px }
|
||||
]
|
||||
},
|
||||
ListLayout { orientation = horizontal, margin-top = 16px, padding = 8px, vertical-align = center,
|
||||
border = _{ width = 1px, style = solid, color = #FF000000 }, radius = 4px,
|
||||
content = [
|
||||
View {
|
||||
id = controlsHiddable, width = 32px, height = 16px, margin-right = 16px,
|
||||
background-color = red
|
||||
},
|
||||
"Visibility",
|
||||
DropDownList {
|
||||
id = controlsHiddableList, margin-left = 16px, current = 0,
|
||||
items = ["visible", "invisible", "gone"]
|
||||
},
|
||||
]
|
||||
},
|
||||
Button {
|
||||
id = controlsMessage, margin-top = 16px, content = "Show message"
|
||||
}
|
||||
|
@ -142,6 +156,9 @@ func createControlsDemo(session rui.Session) rui.View {
|
|||
rui.ShowMessage("Hello", "Hello world!!!", session)
|
||||
})
|
||||
|
||||
rui.Set(view, "controlsHiddableList", rui.DropDownEvent, func(list rui.DropDownList, number int) {
|
||||
rui.Set(view, "controlsHiddable", rui.Visibility, number)
|
||||
})
|
||||
return view
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ var enumProperties = map[string]struct {
|
|||
},
|
||||
Visibility: {
|
||||
[]string{"visible", "invisible", "gone"},
|
||||
Visibility,
|
||||
"",
|
||||
[]string{"visible", "invisible", "gone"},
|
||||
},
|
||||
TextAlign: {
|
||||
|
|
|
@ -5,8 +5,5 @@
|
|||
}
|
||||
],
|
||||
"settings": {
|
||||
"go.buildFlags": [
|
||||
"-buildvcs=false"
|
||||
]
|
||||
}
|
||||
}
|
17
view.go
17
view.go
|
@ -370,6 +370,23 @@ func viewPropertyChanged(view *viewData, tag string) {
|
|||
switch tag {
|
||||
case Disabled:
|
||||
updateInnerHTML(view.parentHTMLID(), session)
|
||||
return
|
||||
|
||||
case Visibility:
|
||||
switch GetVisibility(view, "") {
|
||||
case Invisible:
|
||||
updateCSSProperty(htmlID, Visibility, "hidden", session)
|
||||
updateCSSProperty(htmlID, "display", "", session)
|
||||
|
||||
case Gone:
|
||||
updateCSSProperty(htmlID, Visibility, "hidden", session)
|
||||
updateCSSProperty(htmlID, "display", "none", session)
|
||||
|
||||
default:
|
||||
updateCSSProperty(htmlID, Visibility, "visible", session)
|
||||
updateCSSProperty(htmlID, "display", "", session)
|
||||
}
|
||||
return
|
||||
|
||||
case Background:
|
||||
updateCSSProperty(htmlID, Background, view.backgroundCSS(session), session)
|
||||
|
|
Loading…
Reference in New Issue