Set up a replacement for the new Grid test. It doesn't work, but now we can more easily fix it.

This commit is contained in:
Pietro Gagliardi 2014-09-03 18:36:33 -04:00
parent 3bd1ec9334
commit fd0ef41965
2 changed files with 10 additions and 13 deletions

View File

@ -18,7 +18,7 @@ type repainter struct {
height TextField height TextField
repaint Button repaint Button
all Button all Button
stack Stack grid Grid
xv int xv int
yv int yv int
@ -31,9 +31,6 @@ func newRepainter(times int) *repainter {
r.img = tileImage(times) r.img = tileImage(times)
r.area = NewArea(r.img.Rect.Dx(), r.img.Rect.Dy(), r) r.area = NewArea(r.img.Rect.Dx(), r.img.Rect.Dy(), r)
r.area.OnTextFieldDismissed(r.tfdone) r.area.OnTextFieldDismissed(r.tfdone)
grid2 := NewGrid()
grid2.Add(r.area, nil, South, true, Fill, true, Fill, 1, 1)
grid2.Add(NewButton("X"), nil, East, false, LeftTop, true, Center, 1, 1)
r.x = NewTextField() r.x = NewTextField()
r.x.OnChanged(r.setx) r.x.OnChanged(r.setx)
r.y = NewTextField() r.y = NewTextField()
@ -47,14 +44,14 @@ func newRepainter(times int) *repainter {
r.all = NewButton("All") r.all = NewButton("All")
r.all.OnClicked(r.doall) r.all.OnClicked(r.doall)
grid := NewGrid() grid := NewGrid()
grid.Add(r.x, nil, North, true, Fill, false, LeftTop, 1, 1) grid.Add(r.area, nil, South, true, Fill, true, Fill, 3, 6)
grid.Add(r.y, r.x, East, true, Fill, false, LeftTop, 1, 1) grid.Add(r.x, nil, East, true, Fill, false, LeftTop, 1, 1)
grid.Add(r.repaint, nil, East, false, 0, false, LeftTop, 1, 1) grid.Add(r.y, nil, South, true, Fill, false, LeftTop, 1, 1)
grid.Add(r.width, r.x, South, true, Fill, false, LeftTop, 1, 1) grid.Add(r.width, nil, South, true, Fill, false, LeftTop, 1, 1)
grid.Add(r.height, nil, East, true, Fill, false, LeftTop, 1, 1) grid.Add(r.height, nil, South, true, Fill, false, LeftTop, 1, 1)
grid.Add(r.all, nil, East, false, Center, false, LeftTop, 1, 1) grid.Add(r.repaint, nil, South, true, Fill, true, Fill, 1, 1)
r.stack = NewVerticalStack(grid2, grid) grid.Add(r.all, nil, South, true, Center, false, LeftTop, 1, 1)
r.stack.SetStretchy(0) r.grid = grid
return r return r
} }

View File

@ -147,7 +147,7 @@ func (tw *testwin) make(done chan struct{}) {
}) })
tw.icons, tw.il = readIcons() // repainter uses these tw.icons, tw.il = readIcons() // repainter uses these
tw.repainter = newRepainter(15) tw.repainter = newRepainter(15)
tw.t.Append("Repaint", tw.repainter.stack) tw.t.Append("Repaint", tw.repainter.grid)
tw.addfe() tw.addfe()
tw.icontbl = NewTable(reflect.TypeOf(icon{})) tw.icontbl = NewTable(reflect.TypeOf(icon{}))
tw.icontbl.Lock() tw.icontbl.Lock()