MCPcopy Create free account
hub / github.com/NV404/gova / FindButton

Method FindButton

testing.go:106–123  ·  view source on GitHub ↗

FindButton returns the nth Button node (depth-first).

(n int)

Source from the content-addressed store, hash-verified

104
105// FindButton returns the nth Button node (depth-first).
106func (rt *RenderedTree) FindButton(n int) ButtonResult {
107 count := 0
108 var result ButtonResult
109 walkNodes(rt.root, func(node *viewNode) bool {
110 if node.kind == viewKindButton && node.button != nil {
111 if count == n {
112 result.Label = node.button.label
113 result.handler = node.button.handler
114 result.tree = rt
115 result.found = true
116 return false
117 }
118 count++
119 }
120 return true
121 })
122 return result
123}
124
125// FindButtonByLabel returns the first Button with a matching label.
126func (rt *RenderedTree) FindButtonByLabel(label string) ButtonResult {

Callers 1

TestTestRenderCounterFunction · 0.80

Calls 1

walkNodesFunction · 0.85

Tested by 1

TestTestRenderCounterFunction · 0.64