fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design

Home Page:https://fyne.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select Does Not Gain Focus When Tapped

jimorc opened this issue · comments

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

The Select widget does not gain focus when tapped.

How to reproduce

  1. Build the example program.
  2. Run the program and set the focus to either the Entry or the Button.
  3. Click on the Select and select one of the items.
  4. Focus remains on whichever of the Entry or Button that had focus before.

Screenshots

No response

Example code

package main

import (
	"fmt"

	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/layout"
	"fyne.io/fyne/v2/widget"
)

func main() {
	myApp := app.New()
	mainWin := myApp.NewWindow("Select Test")
	entry := widget.NewEntry()
	sel := widget.NewSelect([]string{"Item 1", "Item 2", "Item 3"}, selectChanged)
	button := widget.NewButton("OK", tapped)
	box := container.New(layout.NewVBoxLayout(), entry, sel, button)
	mainWin.SetContent(box)
	mainWin.ShowAndRun()
}

func selectChanged(value string) {
	fmt.Printf("Selected value = %v\n", value)
}

func tapped() {
	fmt.Println("In tapped")
}

Fyne version

2.4.4

Go compiler version

1.22.1

Operating system and version

macOS 14.4.1

Additional Information

No response

Fixed on develop for v2.5.0