edit.go
func (w *Window) AddEdit(x, y, width int, target *string) *Edit {
	// we can ignore error for builtins
	e, _ := w.AddWidget(WidgetEdit, x, y)
	edit := e.(*Edit)
	edit.width = width

	// save current sizes to detect actual window resizes
	edit.prevX = w.x
	edit.prevY = w.y

	edit.Resize()

	// cursor
	edit.cx = -1
	edit.cy = -1

	// set target string
	edit.SetText(target, true)

	// flip attributes
	a := defaultAttributes()
	a2 := Attributes{
		Fg: a.Bg,
		Bg: a.Fg,
	}
	edit.SetAttributes(a2)

	return edit
}
func (w *Window) AddEdit(x, y, width int, target *string) *Edit {
	// we can ignore error for builtins
	e, _ := w.AddWidget(WidgetEdit, x, y)
	edit := e.(*Edit)
	edit.width = width

	// save current sizes to detect actual window resizes
	edit.prevX = w.x
	edit.prevY = w.y

	edit.Resize()

	// cursor
	edit.cx = -1
	edit.cy = -1

	// set target string
	edit.SetText(target, true)

	// flip attributes
	a := defaultAttributes()
	a2 := Attributes{
		Fg: a.Bg,
		Bg: a.Fg,
	}
	edit.SetAttributes(a2)

	return edit
}
func ( w * Window ) AddEdit ( x , y , width int , target * string ) * Edit { // we can ignore error for builtins e , _ := w . AddWidget ( WidgetEdit , x , y ) edit := e . ( * Edit ) edit . width = width // save current sizes to detect actual window resizes edit . prevX = w . x edit . prevY = w . y edit . Resize ( ) // cursor edit . cx = - 1 edit . cy = - 1 // set target string edit . SetText ( target , true ) // flip attributes a := defaultAttributes ( ) a2 := Attributes { Fg : a . Bg , Bg : a . Fg , } edit . SetAttributes ( a2 ) return edit }
// AddEdit is a convenience function to add a new edit to a window.  Capacity
// and width determine the maxima of the returned value.  It wraps the
// AddWidget call.  AddEdit must be called from queue.
AddEdit is a convenience function to add a new edit to a window . Capacity and width determine the maxima of the returned value . It wraps the AddWidget call . AddEdit must be called from queue .