use disabled list to avoid builtin focus handling

This commit is contained in:
Drew Weymouth
2023-11-02 19:24:52 -07:00
parent af95d150e8
commit b24321ee40
6 changed files with 51 additions and 18 deletions
+33
View File
@@ -0,0 +1,33 @@
package widgets
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
)
// DisabledList extends List to be disabled so that the
// focus manager considers it unfocusable.
// This is needed since we handle row focusability ourselves.
type DisabledList struct {
widget.List
}
func NewDisabledList(len func() int, create func() fyne.CanvasObject, update func(widget.GridWrapItemID, fyne.CanvasObject)) *DisabledList {
g := &DisabledList{
List: widget.List{
Length: len,
CreateItem: create,
UpdateItem: update,
},
}
g.ExtendBaseWidget(g)
return g
}
var _ fyne.Disableable = (*DisabledList)(nil)
func (g *DisabledList) Disabled() bool { return true }
func (g *DisabledList) Disable() {}
func (g *DisabledList) Enable() {}