SetFocusEvent sets the keyboard input focus on this item or the first item within it that can be focused (if none, then just sets focus to this object). This sends an [events.Focus] event, which typically results in the widget being styled as focused. See [WidgetBase.SetFocus] for a version that doe
()
| 496 | // the widget being styled as focused. See [WidgetBase.SetFocus] for |
| 497 | // a version that does not. |
| 498 | func (wb *WidgetBase) SetFocusEvent() { |
| 499 | foc := wb.This.(Widget) |
| 500 | if !wb.AbilityIs(abilities.Focusable) { |
| 501 | foc = wb.focusableInThis() |
| 502 | if foc == nil { |
| 503 | foc = wb.This.(Widget) |
| 504 | } |
| 505 | } |
| 506 | em := wb.Events() |
| 507 | if em != nil { |
| 508 | // fmt.Println("grab focus:", foc) |
| 509 | em.setFocusEvent(foc) // doesn't send event |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | // focusableInThis returns the first Focusable element within this widget |
| 514 | func (wb *WidgetBase) focusableInThis() Widget { |
no test coverage detected