mirror of
https://github.com/rivo/tview.git
synced 2024-11-15 06:12:46 +00:00
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
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (m *Modal) Focus(delegate func(p Primitive)) {
|
||||
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
|
||||
// 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
|
||||
// refreshed so you may want to use the "changed" handler to redraw the screen.
|
||||
// in a separate goroutine. Doing so does not automatically cause the screen to
|
||||
// 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
|
||||
// should follow:
|
||||
|
Loading…
Reference in New Issue
Block a user