MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / AddButtons

Method AddButtons

internal/ui/components/wide_modal.go:112–134  ·  view source on GitHub ↗

AddButtons adds buttons to the window.

(labels []string)

Source from the content-addressed store, hash-verified

110
111// AddButtons adds buttons to the window.
112func (m *WideModal) AddButtons(labels []string) *WideModal {
113 for index, label := range labels {
114 m.buttons = append(m.buttons, label)
115 func(i int, l string) {
116 m.form.AddButton(label, func() {
117 if m.done != nil {
118 m.done(i, l)
119 }
120 })
121 button := m.form.GetButton(m.form.GetButtonCount() - 1)
122 button.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
123 switch event.Key() {
124 case tcell.KeyDown, tcell.KeyRight:
125 return tcell.NewEventKey(tcell.KeyTab, 0, tcell.ModNone)
126 case tcell.KeyUp, tcell.KeyLeft:
127 return tcell.NewEventKey(tcell.KeyBacktab, 0, tcell.ModNone)
128 }
129 return event
130 })
131 }(index, label)
132 }
133 return m
134}
135
136// ClearButtons removes all buttons from the window.
137func (m *WideModal) ClearButtons() *WideModal {

Callers 9

CreateAboutDialogFunction · 0.95
showMessageMethod · 0.80
CreateConfirmDialogFunction · 0.80
createBaseModalFunction · 0.80
showBootstrapRunFormMethod · 0.80
showExecutingModalMethod · 0.80
ShowErrorModalMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected