mirror of https://github.com/rivo/tview.git
Added SetFocus() to Modal, focuses on the provided button. Resolves #364
This commit is contained in:
parent
2d957c4be0
commit
0f6549646b
6
modal.go
6
modal.go
|
@ -126,6 +126,12 @@ func (m *Modal) ClearButtons() *Modal {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetFocus shifts the focus to the button with the given index.
|
||||||
|
func (m *Modal) SetFocus(index int) *Modal {
|
||||||
|
m.form.SetFocus(index)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
// Focus is called when this primitive receives focus.
|
// Focus is called when this primitive receives focus.
|
||||||
func (m *Modal) Focus(delegate func(p Primitive)) {
|
func (m *Modal) Focus(delegate func(p Primitive)) {
|
||||||
delegate(m.form)
|
delegate(m.form)
|
||||||
|
|
|
@ -298,8 +298,9 @@ func (t *TextView) SetRegions(regions bool) *TextView {
|
||||||
|
|
||||||
// SetChangedFunc sets a handler function which is called when the text of the
|
// SetChangedFunc sets a handler function which is called when the text of the
|
||||||
// text view has changed. This is useful when text is written to this io.Writer
|
// text view has changed. This is useful when text is written to this io.Writer
|
||||||
// in a separate goroutine. This does not automatically cause the screen to be
|
// in a separate goroutine. Doing so does not automatically cause the screen to
|
||||||
// refreshed so you may want to use the "changed" handler to redraw the screen.
|
// be refreshed so you may want to use the "changed" handler to redraw the
|
||||||
|
// screen.
|
||||||
//
|
//
|
||||||
// Note that to avoid race conditions or deadlocks, there are a few rules you
|
// Note that to avoid race conditions or deadlocks, there are a few rules you
|
||||||
// should follow:
|
// should follow:
|
||||||
|
|
Loading…
Reference in New Issue