mgnumericentry

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 10 Imported by: 0

README

MGNumericEntry

Um componente customizado para Fyne (Go) que fornece um campo de entrada numérica com validação, limites (min/max), incremento/decremento e botões de spin com auto-repeat (pressionar e segurar).

Ideal para formulários, configurações e interfaces desktop que precisam de controle numérico preciso.


✨ Recursos

  • 🔢 Entrada somente numérica
  • ➕➖ Incremento e decremento com passo configurável
  • ⏫⏬ Botões de spin (▲ / ▼) com auto-repeat
  • 🔒 Respeita valores mínimos e máximos
  • 🔄 Callback OnChanged ao alterar valor
  • 🖱️ Suporte a mouse, teclado e foco

📦 Instalação

go get github.com/mugomes/mgnumericentry

🚀 Uso básico

Numeric Entry simples
entry := mgnumericentry.NewMGNumericEntry(0, 100, 10)

entry.OnChanged = func(v int) {
	fmt.Println("Valor alterado:", v)
}

Numeric Entry com botões de incremento/decremento
box, entry := mgnumericentry.NewMGNumericEntryWithButtons(0, 100, 5)

entry.OnChanged = func(v int) {
	fmt.Println("Novo valor:", v)
}

w.SetContent(box)

⚙️ Propriedades principais

MGNumericEntry
Campo Tipo Descrição
Min int Valor mínimo permitido
Max int Valor máximo permitido
Value int Valor atual
OnChanged func(int) Callback ao alterar o valor

🧠 Métodos úteis

entry.GetValue()
entry.SetValue(42)

🖥️ Compatibilidade

  • Go 1.25.5
  • Fyne 2.7.1

👤 Autor

Murilo Gomes Julio

🔗 https://mugomes.github.io

📺 https://youtube.com/@mugomesoficial


License

Copyright (c) 2025-2026 Murilo Gomes Julio

Licensed under the MIT license.

All contributions to the MGNumericEntry are subject to this license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MGNumericEntry

type MGNumericEntry struct {
	widget.Entry

	OnChanged func(int)
	// contains filtered or unexported fields
}

func NewMGNumericEntry

func NewMGNumericEntry(min, max, initial int) *MGNumericEntry

func NewMGNumericEntryWithButtons

func NewMGNumericEntryWithButtons(min, max, initial int) (fyne.CanvasObject, *MGNumericEntry)

func (*MGNumericEntry) GetValue

func (e *MGNumericEntry) GetValue() int

func (*MGNumericEntry) SetValue

func (e *MGNumericEntry) SetValue(v int)

func (*MGNumericEntry) TypedKey

func (e *MGNumericEntry) TypedKey(k *fyne.KeyEvent)

func (*MGNumericEntry) TypedRune

func (e *MGNumericEntry) TypedRune(r rune)

Permite apenas digitação de dígitos e sinal '-' (se min < 0)

type MGSmallButton

type MGSmallButton struct {
	widget.BaseWidget
	Label    string
	OnTapped func()
	// contains filtered or unexported fields
}

func (*MGSmallButton) CreateRenderer

func (b *MGSmallButton) CreateRenderer() fyne.WidgetRenderer

func (*MGSmallButton) MinSize

func (b *MGSmallButton) MinSize() fyne.Size

func (*MGSmallButton) MouseDown

func (b *MGSmallButton) MouseDown(ev *desktop.MouseEvent)

func (*MGSmallButton) MouseIn

func (b *MGSmallButton) MouseIn(*desktop.MouseEvent)

func (*MGSmallButton) MouseOut

func (b *MGSmallButton) MouseOut()

func (*MGSmallButton) MouseUp

func (b *MGSmallButton) MouseUp(ev *desktop.MouseEvent)

func (*MGSmallButton) Tapped

func (b *MGSmallButton) Tapped(*fyne.PointEvent)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL