Fyne API "widget.Slider"

widget.Slider


import "fyne.io/fyne/v2/widget"

Usage

type Slider

type Slider struct {
	BaseWidget

	Value float64
	Min   float64
	Max   float64
	Step  float64

	Orientation Orientation
	OnChanged   func(float64)

	// Since: 2.4
	OnChangeEnded func(float64)
}

Slider is a widget that can slide between two fixed values.

func NewSlider

func NewSlider(min, max float64) *Slider

NewSlider returns a basic slider.

func NewSliderWithData

func NewSliderWithData(min, max float64, data binding.Float) *Slider

NewSliderWithData returns a slider connected with the specified data source.

Since: 2.0

func (*Slider) Bind

func (s *Slider) Bind(data binding.Float)

Bind connects the specified data source to this Slider. The current value will be displayed and any changes in the data will cause the widget to update. User interactions with this Slider will set the value into the data source.

Since: 2.0

func (*Slider) CreateRenderer

func (s *Slider) CreateRenderer() fyne.WidgetRenderer

CreateRenderer links this widget to its renderer.

func (*Slider) DragEnd

func (s *Slider) DragEnd()

DragEnd is called when the drag ends.

func (*Slider) Dragged

func (s *Slider) Dragged(e *fyne.DragEvent)

DragEnd is called when a drag event occurs.

func (*Slider) FocusGained

func (s *Slider) FocusGained()

FocusGained is called when this item gained the focus.

Since: 2.4

func (*Slider) FocusLost

func (s *Slider) FocusLost()

FocusLost is called when this item lost the focus.

Since: 2.4

func (*Slider) MinSize

func (s *Slider) MinSize() fyne.Size

MinSize returns the size that this widget should not shrink below

func (*Slider) MouseIn

func (s *Slider) MouseIn(_ *desktop.MouseEvent)

MouseIn is called when a desktop pointer enters the widget.

Since: 2.4

func (*Slider) MouseMoved

func (s *Slider) MouseMoved(_ *desktop.MouseEvent)

MouseMoved is called when a desktop pointer hovers over the widget.

Since: 2.4

func (*Slider) MouseOut

func (s *Slider) MouseOut()

MouseOut is called when a desktop pointer exits the widget

Since: 2.4

func (*Slider) SetValue

func (s *Slider) SetValue(value float64)

SetValue updates the value of the slider and clamps the value to be within the range.

func (*Slider) Tapped

func (s *Slider) Tapped(e *fyne.PointEvent)

Tapped is called when a pointer tapped event is captured.

Since: 2.4

func (*Slider) TypedKey

func (s *Slider) TypedKey(key *fyne.KeyEvent)

TypedKey is called when this item receives a key event.

Since: 2.4

func (*Slider) TypedRune

func (s *Slider) TypedRune(_ rune)

TypedRune is called when this item receives a char event.

Since: 2.4

func (*Slider) Unbind

func (s *Slider) Unbind()

Unbind disconnects any configured data source from this Slider. The current value will remain at the last value of the data source.

Since: 2.0