I am using following code to create and show a window with GUI components as label, entry and button:
// modified from: https://github.com/andlabs/ui/wiki/Getting-Started
package main
import ("github.com/andlabs/ui")
func makewinfn() {
var name = ui.NewEntry()
var button = ui.NewButton("Greet")
var greeting = ui.NewLabel("")
box := ui.NewVerticalBox()
box.Append(ui.NewLabel("Enter your name:"), false)
box.Append(name, false)
box.Append(button, false)
box.Append(greeting, false)
mywindow := ui.NewWindow("MyTitle", 200, 100, false)
mywindow.SetChild(box)
button.OnClicked( func (*ui.Button) {greeting.SetText("Hello, " + name.Text() + "!") } )
mywindow.OnClosing( func (*ui.Window) bool { ui.Quit(); return true } )
mywindow.Show()
}
func main() {
ui.Main(makewinfn)
// HOW TO CREATE AND SHOW ANOTHER SUCH WINDOW HERE ?
// ui.Main(makewinfn) // this opens window only after first is closed.
}
It works well, but as I mentioned in title and as commented in code above, how can I open two such windows simultaneously from main function?
Repeating ui.Main(makewinfn)
in main function leads to second window opening only after first is closed.
Thanks for your help.