Beispiel #1
0
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"))
}
Beispiel #2
0
func (v *View) Run() {

	for !v.quit {
		key := v.f.Run(0)
		switch key {
		case "ENTER":
			focus := v.f.GetFocus()
			if focus == "input" {
				text := v.f.Get("inputtext")
				if len(text) > 0 {
					v.handleInput(text)
					v.f.Set("inputtext", "")
				}
			}
			// TODO: more keys
		}
	}

	v.f.Free()
	stfl.Reset()
}