func execRecursively(command commands.Command, element interface{}) (executed, consume bool) { executed, consume = command.Exec(element) var childExecuted bool if parent, ok := element.(gxui.Parent); ok && !consume { for _, child := range parent.Children() { childExecuted, consume = execRecursively(command, child.Control) executed = executed || childExecuted if consume { return } } } if elementer, ok := element.(Elementer); ok { for _, element := range elementer.Elements() { childExecuted, consume = execRecursively(command, element) executed = executed || childExecuted if consume { return } } } return }