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

Controlling the slider with the left arrow key blocks after 8 steps

chmike 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

When controlling a slider with the keyboard arrow keys, it works without problem when typing the right arrow.

It blocks after more or less 8 steps when typing the left arrow regardless of the initial value. The number of steps may vary.
I tested it with min = -1. and max = 0, steps = 0.001.
The problem doesn't show up when min = 0, max = 1.

How to reproduce

Create

Screenshots

No response

Example code

The following code can be used to see the problem.

When the window shows up, click the slider circle to select it. Then use the right and left arrows.

package main

import (
	"fmt"

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

func main() {
	a := app.New()
	w := a.NewWindow("Hello World")

	slider := widget.NewSlider(-1, 0)
	slider.Step = 0.001
	slider.OnChanged = func(x float64) {
		fmt.Println("slider value:", x)
	}
	w.SetContent(slider)
	w.Resize(fyne.NewSize(200, 200))
	w.ShowAndRun()
}

Fyne version

2.4.4

Go compiler version

go version go1.21.4 linux/amd64

Operating system and version

Ubuntu 22.04.4 LTS (jammy)

Additional Information

No response

This is now resolved on develop and the release branch ready for v2.4.5