Don't forward mouse events to nil items in Flex/Grid. Fixes #425

pull/428/head
Oliver 4 years ago
parent 7cc182c584
commit cce7c98823

@ -51,7 +51,7 @@ For a presentation highlighting this package, compile and run the program found
## Documentation
Refer to https://godoc.org/github.com/rivo/tview for the package's documentation.
Refer to https://pkg.go.dev/github.com/rivo/tview for the package's documentation.
## Dependencies

@ -211,6 +211,9 @@ func (f *Flex) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
// Pass mouse events along to the first child item that takes it.
for _, item := range f.items {
if item.Item == nil {
continue
}
consumed, capture = item.Item.MouseHandler()(action, event, setFocus)
if consumed {
return

@ -670,6 +670,9 @@ func (g *Grid) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
// Pass mouse events along to the first child item that takes it.
for _, item := range g.items {
if item.Item == nil {
continue
}
consumed, capture = item.Item.MouseHandler()(action, event, setFocus)
if consumed {
return

Loading…
Cancel
Save