summaryrefslogtreecommitdiff
path: root/textbox.go
diff options
context:
space:
mode:
Diffstat (limited to 'textbox.go')
-rw-r--r--textbox.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/textbox.go b/textbox.go
index ecbba52..897602d 100644
--- a/textbox.go
+++ b/textbox.go
@@ -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)
}
}