Updated the examples
This commit is contained in:
@@ -14,7 +14,7 @@ func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 300, 0))
|
||||
window.SetTitle("List Sidebar")
|
||||
|
||||
container := elements.NewHBox(true, true)
|
||||
container := elements.NewHBox(elements.SpaceBoth)
|
||||
window.Adopt(container)
|
||||
|
||||
var currentPage tomo.Element
|
||||
@@ -22,29 +22,30 @@ func run () {
|
||||
if currentPage != nil {
|
||||
container.Disown(currentPage)
|
||||
}
|
||||
container.Adopt(newPage, true)
|
||||
container.AdoptExpand(newPage)
|
||||
currentPage = newPage
|
||||
}
|
||||
|
||||
intro := elements.NewLabel (
|
||||
intro := elements.NewLabelWrapped (
|
||||
"The List element can be easily used as a sidebar. " +
|
||||
"Click on entries to flip pages!", true)
|
||||
"Click on entries to flip pages!")
|
||||
button := elements.NewButton("I do nothing!")
|
||||
button.OnClick (func () {
|
||||
popups.NewDialog(popups.DialogKindInfo, window, "", "Sike!")
|
||||
})
|
||||
mouse := testing.NewMouse()
|
||||
input := elements.NewTextBox("Write some text", "")
|
||||
form := elements.NewVBox(false, true)
|
||||
form.Adopt(elements.NewLabel("I have:", false), false)
|
||||
form.Adopt(elements.NewSpacer(true), false)
|
||||
form.Adopt(elements.NewCheckbox("Skin", true), false)
|
||||
form.Adopt(elements.NewCheckbox("Blood", false), false)
|
||||
form.Adopt(elements.NewCheckbox("Bone", false), false)
|
||||
form := elements.NewVBox (
|
||||
elements.SpaceMargin,
|
||||
elements.NewLabel("I have:"),
|
||||
elements.NewLine(),
|
||||
elements.NewCheckbox("Skin", true),
|
||||
elements.NewCheckbox("Blood", false),
|
||||
elements.NewCheckbox("Bone", false))
|
||||
art := testing.NewArtist()
|
||||
|
||||
makePage := func (name string, callback func ()) tomo.Selectable {
|
||||
cell := elements.NewCell(elements.NewLabel(name, false))
|
||||
cell := elements.NewCell(elements.NewLabel(name))
|
||||
cell.OnSelectionChange (func () {
|
||||
if cell.Selected() { callback() }
|
||||
})
|
||||
@@ -60,7 +61,7 @@ func run () {
|
||||
makePage("art", func () { turnPage(art) }))
|
||||
list.Collapse(96, 0)
|
||||
|
||||
container.Adopt(list, false)
|
||||
container.Adopt(list)
|
||||
turnPage(intro)
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
|
||||
Reference in New Issue
Block a user