Skip to content

SetDoneFunc doesn't seem to work when the inputField is inside a Form #39

@radisb

Description

@radisb

(Sorry if it is something very obvious, but I am very new to golang so maybe I miss something. )

package main

import (
	"github.com/rivo/tview"
	"github.com/gdamore/tcell"
)

func main() {
	app := tview.NewApplication()
	field := tview.NewInputField().SetDoneFunc(func (key tcell.Key) { app.Stop() })

	//container := tview.NewForm().AddFormItem(field)
	// OR
        //container := tview.NewFlex().AddItem(field, 0, 1, true)

	if err := app.SetRoot(container, true).SetFocus(field).Run(); err != nil {
		panic(err)
	}
}

In the code above, when I press Enter, the app stops only with the second container line (inside a Flex). If I use the first container (the Form) nothing is happening. Is this by design?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions