mirror of https://github.com/anoshenko/rui.git
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 }
|
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 {
|
Button {
|
||||||
id = controlsMessage, margin-top = 16px, content = "Show message"
|
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.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
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ var enumProperties = map[string]struct {
|
||||||
},
|
},
|
||||||
Visibility: {
|
Visibility: {
|
||||||
[]string{"visible", "invisible", "gone"},
|
[]string{"visible", "invisible", "gone"},
|
||||||
Visibility,
|
"",
|
||||||
[]string{"visible", "invisible", "gone"},
|
[]string{"visible", "invisible", "gone"},
|
||||||
},
|
},
|
||||||
TextAlign: {
|
TextAlign: {
|
||||||
|
|
|
@ -5,8 +5,5 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"go.buildFlags": [
|
|
||||||
"-buildvcs=false"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
17
view.go
17
view.go
|
@ -370,6 +370,23 @@ func viewPropertyChanged(view *viewData, tag string) {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Disabled:
|
case Disabled:
|
||||||
updateInnerHTML(view.parentHTMLID(), session)
|
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:
|
case Background:
|
||||||
updateCSSProperty(htmlID, Background, view.backgroundCSS(session), session)
|
updateCSSProperty(htmlID, Background, view.backgroundCSS(session), session)
|
||||||
|
|
Loading…
Reference in New Issue