WINDOW: add CreateWindow that has proper padding

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-04 14:39:38 -05:00
parent e00cbad32e
commit 534d631c98
1 changed files with 25 additions and 0 deletions

View File

@ -162,3 +162,28 @@ func DeleteWindow(name string) {
}
}
}
// CreateWindow("my title", "my tabname", 300, 200, makeNumbersPagewin2)
func CreateWindow(title string, tabname string, x int, y int, custom func() ui.Control) *ui.Window {
window := ui.NewWindow(title, x, y, false)
window.OnClosing(func(*ui.Window) bool {
log.Println("createWindow().OnClosing()", title)
return true
})
ui.OnShouldQuit(func() bool {
log.Println("createWindow().Destroy()", title)
window.Destroy()
return true
})
tab := ui.NewTab()
window.SetChild(tab)
window.SetMargined(true)
tab.Append(tabname, custom())
tab.SetMargined(0, true)
window.Show()
return window
}