Buttons respond to enter key, window auto-selects root child

This commit is contained in:
Sasha Koshka
2023-01-09 18:19:19 -05:00
parent 70e0566f3f
commit 80aafdf60c
2 changed files with 26 additions and 2 deletions

View File

@@ -77,7 +77,8 @@ func (backend *Backend) NewWindow (
func (window *Window) Adopt (child tomo.Element) {
if window.child != nil {
child.SetParentHooks (tomo.ParentHooks {})
child.SetParentHooks (tomo.ParentHooks { })
if child.Selectable() { child.Handle(tomo.EventDeselect { }) }
}
window.child = child
if child != nil {
@@ -86,6 +87,7 @@ func (window *Window) Adopt (child tomo.Element) {
MinimumSizeChange: window.childMinimumSizeChangeCallback,
SelectionRequest: window.childSelectionRequestCallback,
})
if child.Selectable() { child.Handle(tomo.EventSelect { }) }
window.resizeChildToFit()
}
window.childMinimumSizeChangeCallback(child.MinimumSize())