func (ui *UserInterface) InputLoop() { event := "" for { if event == "q" { if !ui.confirm_quit { break } else { ui.actionchan <- ActionShowMsg("Quit " + PROGRAM_NAME + " (y/[n])?") event = ui.form.Run(0) if event == "y" { break } ui.actionchan <- ActionShowMsg("") event = "" } } event = ui.form.Run(0) if event != "" { if event == "^L" { stfl.Reset() } else { ui.actionchan <- ActionRawInput(event) } } else { ui.actionchan <- ActionKeyPress{} } } stfl.Reset() }
func main() { f := stfl.Create("<example.stfl>") f.Set("value_a", "This is a little") f.Set("value_b", "test for STFL!") event := "" for event != "ESC" { event = f.Run(0) } stfl.Reset() fmt.Printf("A: %s\n", f.Get("value_a")) fmt.Printf("B: %s\n", f.Get("value_b")) fmt.Printf("C: %s\n", f.Get("value_c")) }