draws widgets in the right order but wrong place
This commit is contained in:
parent
12f3d5ac5c
commit
fb8d1d0940
|
@ -155,7 +155,7 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
||||||
notsure.node.State.Label = "apple/pear"
|
notsure.node.State.Label = "apple/pear"
|
||||||
notsure.makeTK([]string{"apple", "pear"})
|
notsure.makeTK([]string{"apple", "pear"})
|
||||||
}
|
}
|
||||||
notsure.MoveToOffset(w+2, h+1)
|
notsure.MoveToOffset(w+10, h-6)
|
||||||
// notsure.SetText("theNotsure")
|
// notsure.SetText("theNotsure")
|
||||||
notsure.drawView()
|
notsure.drawView()
|
||||||
notsure.Show()
|
notsure.Show()
|
||||||
|
|
8
place.go
8
place.go
|
@ -78,6 +78,8 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||||
|
|
||||||
switch tk.node.WidgetType {
|
switch tk.node.WidgetType {
|
||||||
case widget.Window:
|
case widget.Window:
|
||||||
|
startW += 4
|
||||||
|
startH += 4
|
||||||
for _, child := range tk.children {
|
for _, child := range tk.children {
|
||||||
child.placeWidgets(startW, startH)
|
child.placeWidgets(startW, startH)
|
||||||
sizeW, _ := child.Size()
|
sizeW, _ := child.Size()
|
||||||
|
@ -88,9 +90,9 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||||
case widget.Tab:
|
case widget.Tab:
|
||||||
case widget.Grid:
|
case widget.Grid:
|
||||||
tk.dumpWidget(fmt.Sprintf("PlaceGridS(%d,%d)", startW, startH))
|
tk.dumpWidget(fmt.Sprintf("PlaceGridS(%d,%d)", startW, startH))
|
||||||
// reset the widths and heights maps here
|
// if you reset the values here, grid horizontal stacking doesn't work anymore
|
||||||
tk.widths = make(map[int]int) // how tall each row in the grid is
|
// tk.widths = make(map[int]int) // how tall each row in the grid is
|
||||||
tk.heights = make(map[int]int) // how wide each column in the grid is
|
// tk.heights = make(map[int]int) // how wide each column in the grid is
|
||||||
newW, newH := tk.placeGrid(startW, startH)
|
newW, newH := tk.placeGrid(startW, startH)
|
||||||
tk.full.w0 = newW
|
tk.full.w0 = newW
|
||||||
tk.full.h0 = newH
|
tk.full.h0 = newH
|
||||||
|
|
|
@ -21,10 +21,11 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
||||||
tk.DrawAt(w, h)
|
tk.DrawAt(w, h)
|
||||||
tk.setColor(&colorActiveW) // sets the window to Green BG
|
tk.setColor(&colorActiveW) // sets the window to Green BG
|
||||||
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
||||||
tk.showWidgets()
|
|
||||||
|
|
||||||
tk.setFullSize()
|
tk.setFullSize()
|
||||||
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
|
||||||
|
tk.Show()
|
||||||
|
tk.showWidgets()
|
||||||
}
|
}
|
||||||
|
|
||||||
// re-draws the buttons for each of the windows
|
// re-draws the buttons for each of the windows
|
||||||
|
|
Loading…
Reference in New Issue