NewFormButton creates a new FormButton with the given label and callback.
(label string, selected func())
| 37 | |
| 38 | // NewFormButton creates a new FormButton with the given label and callback. |
| 39 | func NewFormButton(label string, selected func()) *FormButton { |
| 40 | button := tview.NewButton(label) |
| 41 | button.SetSelectedFunc(selected) |
| 42 | |
| 43 | return &FormButton{ |
| 44 | Box: tview.NewBox(), |
| 45 | button: button, |
| 46 | label: label, |
| 47 | selected: selected, |
| 48 | alignment: AlignCenter, // Default to centered |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // SetAlignment sets the button's alignment within its container. |
| 53 | func (b *FormButton) SetAlignment(alignment ButtonAlignment) *FormButton { |
no test coverage detected