Open cgsunshine opened 5 years ago
Maybe you can destroy the current window and create a new window. Here is an example:
func SetupSettingUI(w *ui.Window) *ui.Box {
vbox := ui.NewVerticalBox()
vbox.SetPadded(true)
grid := ui.NewGrid()
grid.SetPadded(true)
vbox.Append(grid, false)
button := ui.NewButton("OK")
button.OnClicked(func(*ui.Button) {
w.Destroy()
SetupUI()
})
grid.Append(button,
1, 3, 1, 1,
false, ui.AlignFill, false, ui.AlignFill)
return vbox
}
SetupUI
function will call function like SetupSettingUI(w *ui.Window) *ui.Box {}
to render a new window.
To open a new window, use ui.NewWindow()
and then the Show
method on that window. Use OnClicked()
to decide what a button does.
How to implement