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.makeTK([]string{"apple", "pear"})
|
||||
}
|
||||
notsure.MoveToOffset(w+2, h+1)
|
||||
notsure.MoveToOffset(w+10, h-6)
|
||||
// notsure.SetText("theNotsure")
|
||||
notsure.drawView()
|
||||
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 {
|
||||
case widget.Window:
|
||||
startW += 4
|
||||
startH += 4
|
||||
for _, child := range tk.children {
|
||||
child.placeWidgets(startW, startH)
|
||||
sizeW, _ := child.Size()
|
||||
|
@ -88,9 +90,9 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
|||
case widget.Tab:
|
||||
case widget.Grid:
|
||||
tk.dumpWidget(fmt.Sprintf("PlaceGridS(%d,%d)", startW, startH))
|
||||
// reset the widths and heights maps here
|
||||
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
|
||||
// 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.heights = make(map[int]int) // how wide each column in the grid is
|
||||
newW, newH := tk.placeGrid(startW, startH)
|
||||
tk.full.w0 = newW
|
||||
tk.full.h0 = newH
|
||||
|
|
|
@ -21,10 +21,11 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
|||
tk.DrawAt(w, h)
|
||||
tk.setColor(&colorActiveW) // sets the window to Green BG
|
||||
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
||||
tk.showWidgets()
|
||||
|
||||
tk.setFullSize()
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue