FindButtonByLabel returns the first Button with a matching label.
(label string)
| 124 | |
| 125 | // FindButtonByLabel returns the first Button with a matching label. |
| 126 | func (rt *RenderedTree) FindButtonByLabel(label string) ButtonResult { |
| 127 | var result ButtonResult |
| 128 | walkNodes(rt.root, func(node *viewNode) bool { |
| 129 | if node.kind == viewKindButton && node.button != nil && node.button.label == label { |
| 130 | result.Label = node.button.label |
| 131 | result.handler = node.button.handler |
| 132 | result.tree = rt |
| 133 | result.found = true |
| 134 | return false |
| 135 | } |
| 136 | return true |
| 137 | }) |
| 138 | return result |
| 139 | } |
| 140 | |
| 141 | // FindToggle returns the nth Toggle node (depth-first). |
| 142 | func (rt *RenderedTree) FindToggle(n int) ToggleResult { |