SetVMSelectedFunc sets the function to be called when a VM is selected.
(handler func(*api.VM))
| 242 | |
| 243 | // SetVMSelectedFunc sets the function to be called when a VM is selected. |
| 244 | func (vl *VMList) SetVMSelectedFunc(handler func(*api.VM)) { |
| 245 | vl.onSelect = handler |
| 246 | |
| 247 | vl.SetSelectedFunc(func(index int, mainText string, secondaryText string, shortcut rune) { |
| 248 | if index >= 0 && index < len(vl.vms) { |
| 249 | if vl.onSelect != nil { |
| 250 | vl.onSelect(vl.vms[index]) |
| 251 | } |
| 252 | } |
| 253 | }) |
| 254 | } |
| 255 | |
| 256 | // SetVMChangedFunc sets the function to be called when selection changes. |
| 257 | func (vl *VMList) SetVMChangedFunc(handler func(*api.VM)) { |
nothing calls this directly
no test coverage detected