diff options
| author | Jeff Carr <[email protected]> | 2025-02-09 04:03:48 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-09 04:03:48 -0600 |
| commit | 955afcb1a98c87dfd51182fa03a25b8ad6495254 (patch) | |
| tree | b04fe2a58148a74331301fc6c87bf9278888dc67 /textbox.go | |
| parent | af3fec6f2073b2d184c2f7ecb10d24658ad2970c (diff) | |
text boxes are forced 5 spaces wide
Diffstat (limited to 'textbox.go')
| -rw-r--r-- | textbox.go | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -40,7 +40,7 @@ func (callertk *guiWidget) showTextbox() { return } - tk := me.textbox.tk + // tk := me.textbox.tk r := new(rectType) // startW, startH := tk.Position() r.w0 = callertk.gocuiSize.w0 + 4 @@ -48,7 +48,7 @@ func (callertk *guiWidget) showTextbox() { r.w1 = r.w0 + 24 r.h1 = r.h0 + 2 me.textbox.tk.forceSizes(r) - me.textbox.tk.dumpWidget("after sizes") + // me.textbox.tk.dumpWidget("after sizes") me.textbox.tk.Show() // actually makes the gocui view. TODO: redo this @@ -58,6 +58,10 @@ func (callertk *guiWidget) showTextbox() { } me.textbox.tk.setColorModal() + me.textbox.tk.v.Clear() + cur := strings.TrimSpace(callertk.String()) + log.Info("setting textbox string to:", cur) + me.textbox.tk.v.WriteString(cur) me.textbox.tk.v.Editable = true me.textbox.tk.v.Wrap = true @@ -71,7 +75,7 @@ func (callertk *guiWidget) showTextbox() { me.textbox.active = true me.textbox.callerTK = callertk - tk.dumpWidget("showTextbox()") + // tk.dumpWidget("showTextbox()") } func theCloseTheTextbox(g *gocui.Gui, v *gocui.View) error { @@ -82,7 +86,7 @@ func theCloseTheTextbox(g *gocui.Gui, v *gocui.View) error { // updates the text and sends an event back to the application func textboxClosed() { // get the text the user entered - newtext := "testing" + var newtext string if me.textbox.tk.v == nil { newtext = "" } else { @@ -91,7 +95,7 @@ func textboxClosed() { newtext = strings.TrimSpace(newtext) me.textbox.active = false me.textbox.tk.Hide() - log.Info("textbox closed", newtext) + log.Info("textbox closed with text:", newtext, me.textbox.callerTK.cuiName) if me.clock.tk.v != nil { me.baseGui.SetCurrentView("help") @@ -108,12 +112,12 @@ func textboxClosed() { win := me.textbox.callerTK.findParentWindow() if win != nil { - win.dumpWidget("redraw this!!!") + // win.dumpWidget("redraw this!!!") tk := me.textbox.callerTK - me.textbox.callerTK.dumpWidget("resize this!!!") + // me.textbox.callerTK.dumpWidget("resize this!!!") me.textbox.callerTK.Size() me.textbox.callerTK.placeWidgets(tk.gocuiSize.w0-4, tk.gocuiSize.h0-4) - tk.dumpWidget("resize:" + tk.String()) + // tk.dumpWidget("resize:" + tk.String()) win.redrawWindow(win.gocuiSize.w0, win.gocuiSize.h0) } } |
