summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-05 10:41:10 -0600
committerJeff Carr <[email protected]>2025-02-05 10:41:10 -0600
commitfb8d1d0940747e647fe48856d5a558ba333d8e90 (patch)
tree141cd5668fff92adbb2852fafb71633f3f62ed80
parent12f3d5ac5cb4add74eb9a053ae1804c661654d09 (diff)
draws widgets in the right order but wrong place
-rw-r--r--eventBindings.go2
-rw-r--r--place.go8
-rw-r--r--window.go3
3 files changed, 8 insertions, 5 deletions
diff --git a/eventBindings.go b/eventBindings.go
index d664b21..3ca09e2 100644
--- a/eventBindings.go
+++ b/eventBindings.go
@@ -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()
diff --git a/place.go b/place.go
index 7ba8a48..31da1fa 100644
--- a/place.go
+++ b/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
diff --git a/window.go b/window.go
index 99ecea6..b7e3761 100644
--- a/window.go
+++ b/window.go
@@ -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