center window on repaint; make sure selected file stays visible in textbox

This commit is contained in:
2025-05-08 21:18:21 -04:00
parent faf6ac348e
commit b186ea934d

View File

@@ -130,6 +130,7 @@ func repaint(img *tk.LabelWidget, name string, opt tk.Opt) {
} else { } else {
tk.App.WmTitle("why") tk.App.WmTitle("why")
} }
tk.App.Center()
} }
func main() { func main() {
@@ -210,6 +211,7 @@ func main() {
if lb != nil { if lb != nil {
lb.SelectionClear("0", "end") lb.SelectionClear("0", "end")
lb.SelectionSet(curr - 1) lb.SelectionSet(curr - 1)
lb.See(curr - 1)
} }
} }
case "Down": case "Down":
@@ -218,6 +220,7 @@ func main() {
if lb != nil { if lb != nil {
lb.SelectionClear("0", "end") lb.SelectionClear("0", "end")
lb.SelectionSet(curr + 1) lb.SelectionSet(curr + 1)
lb.See(curr + 1)
} }
} }
} }
@@ -228,5 +231,6 @@ func main() {
// })) // }))
tk.Pack(img) tk.Pack(img)
tk.App.Center()
tk.App.Wait() tk.App.Wait()
} }