(choices ...string)
| 1202 | } |
| 1203 | |
| 1204 | func (bg *ButtonGroup) SetChoices(choices ...string) { |
| 1205 | |
| 1206 | for _, b := range bg.Buttons { |
| 1207 | b.Destroy() |
| 1208 | } |
| 1209 | |
| 1210 | bg.Buttons = []*Button{} |
| 1211 | bg.Options = choices |
| 1212 | |
| 1213 | for i, c := range choices { |
| 1214 | index := i |
| 1215 | newButton := NewButton(c, nil, nil, bg.WorldSpace, func() { |
| 1216 | bg.ChosenIndex = index |
| 1217 | if bg.Property != nil { |
| 1218 | bg.Property.Set(bg.Buttons[bg.ChosenIndex].Label.TextAsString()) |
| 1219 | } |
| 1220 | if bg.OnChoose != nil { |
| 1221 | bg.OnChoose(index) |
| 1222 | } |
| 1223 | }) |
| 1224 | newButton.Highlighter.HighlightMode = HighlightRing |
| 1225 | bg.Buttons = append(bg.Buttons, newButton) |
| 1226 | } |
| 1227 | |
| 1228 | } |
| 1229 | |
| 1230 | func (bg *ButtonGroup) Update() { |
| 1231 |
no test coverage detected