How to dynamically update widgets
kayon opened this issue · 0 comments
kayon commented
var win *walk.MainWindow
var view *walk. ScrollView
MainWindow{
AssignTo: &win,
...
Children: []Widget{
HSplitter{
Children: []Widget{
PushButton{
OnClicked: func() {
loading := newLoading(win)
go update()
loading.Run()
},
},
...
}
},
ScrollView{
AssignTo: &view,
},
...
}
func update(loading *walk.Dialog) {
defer loading.Close(0)
// fetch data
...
view.Children().Clear()
text1, _ := walk.NewTextLabel(view)
...
btn1, _ := walk.NewPushButton(view)
}
func newLoading(owner walk.Form) *walk.Dialog {
var dialog *walk.Dialog
Dialog{
AssignTo: &dialog,
...
}.Create(owner)
return dialog
}
It doesn't work in goroutine