cmd/scroll: update x/y scrolling demo.

This commit is contained in:
Greg 2019-08-23 11:21:35 -04:00
parent 70e5529a9b
commit f96cdb619a
1 changed files with 9 additions and 3 deletions

View File

@ -80,7 +80,7 @@ func diffInsets(x, y app.Insets) bool {
func eventloop() {
w := app.NewWindow(
app.WithWidth(ui.Dp(200)),
app.WithWidth(ui.Dp(400)),
app.WithHeight(ui.Dp(400)),
app.WithTitle("Tickets"))
ctx := gio.NewContext(w)
@ -93,8 +93,14 @@ func eventloop() {
bg := gio.NewBackground(gio.Color(gray2))
margin := gio.NewInset(gio.Size(ui.Dp(10)))
f1 := gio.NewFlex(gio.Axis(layout.Horizontal))
lbar := gio.NewLabel(" ", gio.Face(face))
f2 := gio.NewFlex(gio.Axis(layout.Vertical))
topbar := gio.NewLabel("Scroll X and Y. Click to select", gio.Face(face))
sh := gio.HScroll(gio.NewFlex(gio.Axis(layout.Horizontal)))
sv := gio.VScroll(gio.NewFlex(gio.Axis(layout.Vertical)))
numlabs := 50
labs := make([][]gio.Widget, numlabs)
sels := make([][]bool, numlabs)
@ -127,7 +133,7 @@ func eventloop() {
}
sysbg(sysinset(bg(margin(
sh(
f1(lbar,f2(topbar,sh(
sv(labs[0]...),
sv(labs[1]...),
sv(labs[2]...),
@ -144,7 +150,7 @@ func eventloop() {
sv(labs[13]...),
sv(labs[14]...),
sv(labs[15]...),
))))).Layout(ctx)
))))))).Layout(ctx)
ctx.Update()
}
}}