add a new UI table example
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
847992a001
commit
52f1673cf7
|
@ -4,6 +4,7 @@ cloud-control-panel
|
||||||
example-gui/example-gui
|
example-gui/example-gui
|
||||||
example-systray/example-systray
|
example-systray/example-systray
|
||||||
example-UI-table/example-UI-table
|
example-UI-table/example-UI-table
|
||||||
|
example-UI-table2/example-UI-table2
|
||||||
example-dnssecsocket/example-dnssecsocket
|
example-dnssecsocket/example-dnssecsocket
|
||||||
example-table1/example-table1
|
example-table1/example-table1
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
run:
|
||||||
|
go run *.go
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build
|
|
@ -0,0 +1,65 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
import "fmt"
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// import "os"
|
||||||
|
// import "fmt"
|
||||||
|
// import "github.com/gookit/config"
|
||||||
|
|
||||||
|
import "github.com/andlabs/ui"
|
||||||
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
import "git.wit.com/wit/gui"
|
||||||
|
|
||||||
|
var cloudwin *ui.Window
|
||||||
|
var cloudtab *ui.Tab
|
||||||
|
var tabcount int
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// make this the main loop in an attempt to figure out the crashes
|
||||||
|
// do not change this until the GUI is stable
|
||||||
|
ui.Main(setupCloudUI)
|
||||||
|
}
|
||||||
|
|
||||||
|
// can not pass any args to this (?)
|
||||||
|
func setupCloudUI() {
|
||||||
|
cloudwin = ui.NewWindow("Cloud Control Panel", 640, 480, false)
|
||||||
|
cloudwin.OnClosing(func(*ui.Window) bool {
|
||||||
|
ui.Quit()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
ui.OnShouldQuit(func() bool {
|
||||||
|
cloudwin.Destroy()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
cloudtab = ui.NewTab()
|
||||||
|
cloudwin.SetChild(cloudtab)
|
||||||
|
cloudwin.SetMargined(true)
|
||||||
|
|
||||||
|
tabcount = 0
|
||||||
|
addTableTab()
|
||||||
|
// cloudtab.Append("Cloud Info", makeCloudInfoBox())
|
||||||
|
// cloudtab.SetMargined(tabcount, true)
|
||||||
|
|
||||||
|
cloudwin.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func addTableTab() {
|
||||||
|
var parts []gui.TableColumnData
|
||||||
|
|
||||||
|
for key, foo := range []string{"BG", "TEXTCOLOR", "BUTTON", "TEXTCOLOR", "TEXTCOLOR", "TEXT", "BUTTON", "TEXT", "BUTTON"} {
|
||||||
|
log.Println(key, foo)
|
||||||
|
|
||||||
|
var b gui.TableColumnData
|
||||||
|
b.CellType = foo
|
||||||
|
b.Heading = fmt.Sprintf("heading%d", key)
|
||||||
|
parts = append(parts, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("Sleep for 2 seconds, then try to add new tabs")
|
||||||
|
time.Sleep(1 * 1000 * 1000 * 1000)
|
||||||
|
gui.AddTableTab(cloudtab, 0, "test seven", 7, parts)
|
||||||
|
}
|
Loading…
Reference in New Issue