opens multiple windows in demo mode

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-29 03:06:17 -06:00
parent 5cc617335d
commit 3539402c37
4 changed files with 53 additions and 21 deletions

View File

@ -4,6 +4,10 @@ all: plugin
plugin: plugin:
go build -v -x -buildmode=plugin -o ../fyne.so go build -v -x -buildmode=plugin -o ../fyne.so
non-plugin:
go build -v -x
./fyne
check-git-clean: check-git-clean:
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1) @git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)

46
fynetest.go Normal file
View File

@ -0,0 +1,46 @@
package main
/*
test fyne code
*/
import (
fyne "fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
var a fyne.App
var w fyne.Window
var w2 fyne.Window
func fynetest() {
a = app.New()
w = a.NewWindow("Hello")
hello := widget.NewLabel("Hello Fyne!")
w.SetContent(container.NewVBox(
hello,
widget.NewButton("Hi!", func() {
hello.SetText("Welcome :)")
bobWindow()
}),
))
w.Show()
// bobWindow()
// go w.ShowAndRun()
}
func bobWindow() {
bw := a.NewWindow("Hello bob")
bob := widget.NewLabel("bob")
bw.SetContent(container.NewVBox(
bob,
))
bw.Show()
}

21
main.go
View File

@ -10,9 +10,6 @@ package main
import ( import (
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/toolkits/tree" "go.wit.com/toolkits/tree"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
) )
func init() { func init() {
@ -36,27 +33,11 @@ func init() {
showOptions() showOptions()
go simpleStdin() go simpleStdin()
fynetest()
} }
// this must be defined for plugin's, but is never run // this must be defined for plugin's, but is never run
// if you build this as a non-plugin, this will run // if you build this as a non-plugin, this will run
func main() { func main() {
fynetest() fynetest()
} a.Run()
func fynetest() {
a := app.New()
w := a.NewWindow("Hello")
hello := widget.NewLabel("Hello Fyne!")
w.SetContent(container.NewVBox(
hello,
widget.NewButton("Hi!", func() {
hello.SetText("Welcome :)")
}),
))
w.ShowAndRun()
} }

View File

@ -55,7 +55,8 @@ func simpleStdin() {
tree.ListWidgets() tree.ListWidgets()
case "b": case "b":
log.Log(NOW, "show buttons") log.Log(NOW, "show buttons")
tree.ShowButtons() // tree.ShowButtons()
bobWindow()
case "g": case "g":
me.myTree.SendToolkitLoad("gocui") me.myTree.SendToolkitLoad("gocui")
case "a": case "a":