Пример #1
0
func main() {
	exit := false
	window := fltk.NewWindow(300, 180)
	l := fltk.NewLayoutCalc(window)
	window.SetCallback(func() { exit = true; println("CLOSED"); window.Destroy() })
	window.Begin()
	i := fltk.NewInput(l.X, l.Y, l.W, 30)
	l.Add(i)
	i.StealEvents(fltk.PUSH_MASK | fltk.DRAG_MASK | fltk.PASTE_MASK)
	i.SetEventHandler(func(e *fltk.Event) {
		if e.Stolen {
			fmt.Println("STOLE EVENT:", strconv.Itoa(e.Event), "widget:", e.Widget, "push: ", fltk.PUSH)
			if e.Event == fltk.PUSH {
				fmt.Println("\nMouse Position:", i.MousePosition(), "\n")
			}
			if (e.Event != fltk.PUSH && e.Event != fltk.RELEASE && e.Event != fltk.PASTE) || e.Button == 1 {
				fmt.Println("CONTINUING EVENT:", strconv.Itoa(e.Event), "widget:", e.Widget, "push: ", fltk.PUSH)
				e.Continue()
			}
		}
	})
	fmt.Println("Editor at y: ", l.Y)
	e := fltk.NewTextEditor(l.X, l.Y, l.W, l.H)
	window.Resizable(e)
	window.End()
	window.Show([]string{})
	fltk.Run(func() bool { return !exit })
}
Пример #2
0
func main() {
	w := fltk.NewWindow(300, 180)
	w.Begin()
	b := fltk.NewWidget(20, 40, 260, 100, "Hello there!")
	b.Box(fltk.UP_BOX)
	b.LabelFont(fltk.HELVETICA_BOLD_ITALIC)
	b.LabelSize(36)
	b.LabelType(fltk.SHADOW_LABEL)
	w.End()
	w.Show([]string{})
	fltk.Run(func() bool { return true })
}